R: Create a Function Value Table

fv {spatstat} | R Documentation

## Create a Function Value Table

### Description

Advanced Use Only. This low-level function creates an object of class `"fv"` from raw numerical data.

### Usage

    fv(x, argu = "r", ylab = NULL, valu, fmla = NULL, alim = NULL,
       labl = names(x), desc = NULL, unitname = NULL, fname = NULL, yexp = ylab)

### Arguments

`x` | A data frame with at least 2 columns containing the values of the function argument and the corresponding values of (one or more versions of) the function.
`argu` | String. The name of the column of `x` that contains the values of the function argument.
`ylab` | Either `NULL`, or an R language expression representing the mathematical name of the function. See Details.
`valu` | String. The name of the column of `x` that should be taken as containing the function values, in cases where a single column is required.
`fmla` | Either `NULL`, or a `formula` specifying the default plotting behaviour. See Details.
`alim` | Optional. The default range of values of the function argument for which the function will be plotted. Numeric vector of length 2.
`labl` | Optional. Plot labels for the columns of `x`. A vector of strings, with one entry for each column of `x`.
`desc` | Optional. Descriptions of the columns of `x`. A vector of strings, with one entry for each column of `x`.
`unitname` | Optional. Name of the unit (usually a unit of length) in which the function argument is expressed. Either a single character string, or a vector of two character strings giving the singular and plural forms, respectively.
`fname` | Optional. The name of the function itself. A character string.
`yexp` | Optional. Alternative form of `ylab` more suitable for annotating an axis of the plot. See Details.

### Details

This documentation is provided for experienced programmers who want to modify the internal behaviour of spatstat. Other users please see `fv.object`.

The low-level function `fv` is used to create an object of class `"fv"` from raw numerical data.

The data frame `x` contains the numerical data. It should have one column (typically but not necessarily named `"r"`) giving the values of the function argument for which the function has been evaluated; and at least one other column, containing the corresponding values of the function.

Typically there is more than one column of function values. These columns typically give the values of different versions or estimates of the same function, for example, different estimates of the K function obtained using different edge corrections. However they may also contain the values of related functions such as the derivative or hazard rate.

`argu` specifies the name of the column of `x` that contains the values of the function argument (typically `argu="r"` but this is not compulsory).

`valu` specifies the name of another column that contains the ‘recommended’ estimate of the function. It will be used to provide function values in those situations where a single column of data is required. For example, `envelope` computes its simulation envelopes using the recommended value of the summary function.

`fmla` specifies the default plotting behaviour. It should be a formula, or a string that can be converted to a formula. Variables in the formula are names of columns of `x`. See `plot.fv` for the interpretation of this formula.

`alim` specifies the recommended range of the function argument. This is used in situations where statistical theory or statistical practice indicates that the computed estimates of the function are not trustworthy outside a certain range of values of the function argument. By default, `plot.fv` will restrict the plot to this range.

`fname` is a string giving the name of the function itself. For example, the K function would have `fname="K"`.

`ylab` is a mathematical expression for the function value, used when labelling an axis of the plot, or when printing a description of the function. It should be an R language object. For example the K function's mathematical name K(r) is rendered by `ylab=quote(K(r))`.

If `yexp` is present, then `ylab` will be used only for printing, and `yexp` will be used for annotating axes in a plot. (Otherwise `yexp` defaults to `ylab`). For example the cross-type K function K[1,2](r) is rendered by something like `ylab=quote(Kcross[1,2](r))` and `yexp=quote(Kcross[list(1,2)](r))` to get the most satisfactory behaviour.

(A useful tip: use `substitute` instead of `quote` to insert values of variables into an expression, e.g. `substitute(Kcross[i,j](r), list(i=42,j=97))` yields the same as `quote(Kcross[42, 97](r))`.)

`labl` is a character vector specifying plot labels for each column of `x`. These labels will appear on the plot axes (in non-default plots), legends and printed output. Entries in `labl` may contain the string `"%s"` which will be replaced by `fname`. For example the border-corrected estimate of the K function has label `"%s[bord](r)"` which becomes `"K[bord](r)"`.

`desc` is a character vector containing intelligible explanations of each column of `x`. Entries in `desc` may contain the string `"%s"` which will be replaced by `ylab`. For example the border correction estimate of the K function has description `"border correction estimate of %s"`.

### Value

An object of class `"fv"`, see `fv.object`.

### Author(s)

Adrian Baddeley Adrian.Baddeley@curtin.edu.au

and Rolf Turner r.turner@auckland.ac.nz

### See Also

See `plot.fv` for plotting an `"fv"` object.

See `as.function.fv` to convert an `"fv"` object to an R function.

Use `cbind.fv` to combine several `"fv"` objects. Use `bind.fv` to glue additional columns onto an existing `"fv"` object.

Use `range.fv` to compute the range of y values for a function, and `with.fv` for more complicated calculations.

The functions `fvnames`, `fvnames<-` allow the user to use standard abbreviations to refer to columns of an `"fv"` object.

Undocumented functions for modifying an `"fv"` object include `tweak.fv.entry` and `rebadge.fv`.

### Examples

      df <- data.frame(r=seq(0,5,by=0.1))
      df <- transform(df, a=pi*r^2, b=3*r^2)
      X <- fv(df, "r", quote(A(r)),
                  "a", cbind(a, b) ~ r,
                  alim=c(0,4),
                  labl=c("r", "%s[true](r)", "%s[approx](r)"),
                  desc=c("radius of circle",
                         "true area %s",
                         "rough area %s"),
                  fname="A")
      X

[Package spatstat version 1.54-0 Index]