Learn R Programming

spatstat.core (version 2.3-1)

Extract.fv: Extract or Replace Subset of Function Values

Description

Extract or replace a subset of an object of class "fv".

Usage

# S3 method for fv
[(x, i, j, …, drop=FALSE)

# S3 method for fv [(x, i, j) <- value

# S3 method for fv $(x, name) <- value

Arguments

x

a function value object, of class "fv" (see fv.object). Essentially a data frame.

i

any appropriate subset index. Selects a subset of the rows of the data frame, i.e. a subset of the domain of the function(s) represented by x.

j

any appropriate subset index for the columns of the data frame. Selects some of the functions present in x.

name

the name of a column of the data frame.

Ignored.

drop

Logical. If TRUE, the result is a data frame or vector containing the selected rows and columns of data. If FALSE (the default), the result is another object of class "fv".

value

Replacement value for the column or columns selected by name or j.

Value

The result of [.fv with drop=TRUE is a data frame or vector.

Otherwise, the result is another object of class "fv".

Details

These functions extract a designated subset of an object of class "fv", or replace the designated subset with other data, or delete the designated subset.

The subset is specified by the row index i and column index j, or by the column name name. Either i or j may be missing, or both may be missing.

The function [.fv is a method for the generic operator [ for the class "fv". It extracts the designated subset of x, and returns it as another object of class "fv" (if drop=FALSE) or as a data frame or vector (if drop=TRUE).

The function [<-.fv is a method for the generic operator [<- for the class "fv". If value is NULL, the designated subset of x will be deleted from x. Otherwise, the designated subset of x will be replaced by the data contained in value. The return value is the modified object x.

The function $<-.fv is a method for the generic operator $<- for the class "fv". If value is NULL, the designated column of x will be deleted from x. Otherwise, the designated column of x will be replaced by the data contained in value. The return value is the modified object x.

See Also

fv.object

Examples

Run this code
# NOT RUN {
 K <- Kest(cells)

 # discard the estimates of K(r) for r  > 0.1
 Ksub <- K[K$r <= 0.1, ]

 # extract the border method estimates
 bor <- K[ , "border", drop=TRUE]
 # or equivalently
 bor <- K$border

 # remove the border-method estimates
 K$border <- NULL
 K
# }

Run the code above in your browser using DataLab