# as.function.fv

0th

Percentile

##### Convert Function Value Table to Function

Converts an object of class "fv" to an R language function.

Keywords
methods, spatial
##### Usage
# S3 method for fv
as.function(x, ..., value=".y", extrapolate=FALSE)  # S3 method for rhohat
as.function(x, ..., value=".y", extrapolate=TRUE)
##### Arguments
x

Object of class "fv" or "rhohat".

Ignored.

value

Optional. Character string or character vector selecting one or more of the columns of x for use as the function value. See Details.

extrapolate

Logical, indicating whether to extrapolate the function outside the domain of x. See Details.

##### Details

A function value table (object of class "fv") is a convenient way of storing and plotting several different estimates of the same function. Objects of this class are returned by many commands in spatstat, such as Kest which returns an estimate of Ripley's $K$-function for a point pattern dataset.

Sometimes it is useful to convert the function value table to a function in the R language. This is done by as.function.fv. It converts an object x of class "fv" to an R function f.

If f <- as.function(x) then f is an R function that accepts a numeric argument and returns a corresponding value for the summary function by linear interpolation between the values in the table x.

Argument values lying outside the range of the table yield an NA value (if extrapolate=FALSE) or the function value at the nearest endpoint of the range (if extrapolate = TRUE). To apply different rules to the left and right extremes, use extrapolate=c(TRUE,FALSE) and so on.

Typically the table x contains several columns of function values corresponding to different edge corrections. Auxiliary information for the table identifies one of these columns as the recommended value. By default, the values of the function f <- as.function(x) are taken from this column of recommended values. This default can be changed using the argument value, which can be a character string or character vector of names of columns of x. Alternatively value can be one of the abbreviations used by fvnames.

If value specifies a single column of the table, then the result is a function f(r) with a single numeric argument r (with the same name as the orginal argument of the function table).

If value specifies several columns of the table, then the result is a function f(r,what) where r is the numeric argument and what is a character string identifying the column of values to be used.

The formal arguments of the resulting function are f(r, what=value), which means that in a call to this function f, the permissible values of what are the entries of the original vector value; the default value of what is the first entry of value.

The command as.function.fv is a method for the generic command as.function.

##### Value

A function(r) or function(r,what) where r is the name of the original argument of the function table.

fv, fv.object, fvnames, plot.fv, Kest

##### Aliases
• as.function.fv
• as.function.rhohat
##### Examples
# NOT RUN {
K <- Kest(cells)
f <- as.function(K)
f
f(0.1)
g <- as.function(K, value=c("iso", "trans"))
g
g(0.1, "trans")
# }

Documentation reproduced from package spatstat, version 1.61-0, License: GPL (>= 2)

### Community examples

Looks like there are no examples yet.