# as.function.fv

##### Convert Function Value Table to Function

Converts an object of class `"fv"`

to an Rlanguage function.

##### Usage

```
## S3 method for class 'fv':
as.function(x, ..., value, extrapolate=FALSE)
``` ## S3 method for class 'rhohat':
as.function(x, ..., value, extrapolate=TRUE)

##### Arguments

- x
- Object of class
`"fv"`

- ...
- Ignored.
- value
- Optional. String selecting one of the columns of
`x`

for use as the function value. - extrapolate
- Logical value 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 `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 Rlanguage. This is done by
`as.function.fv`

. It converts an object `x`

of class `"fv"`

to an Rfunction `f`

.

If `f <- as.function(x)`

then `f`

is a function with one numeric
argument, that performs 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`

).

The command `as.function.fv`

is a method for the generic command
`as.function`

.

##### Value

- A
`function`

with one argument.

##### See Also

##### Examples

```
data(cells)
K <- Kest(cells)
f <- as.function(K)
f(0.1)
```

*Documentation reproduced from package spatstat, version 1.31-3, License: GPL (>= 2)*