Learn R Programming

spatstat.geom (version 3.2-5)

subset.hyperframe: Subset of Hyperframe Satisfying A Condition

Description

Given a hyperframe, return the subset specified by imposing a condition on each row, and optionally by choosing only some of the columns.

Usage

# S3 method for hyperframe
subset(x, subset, select, ...)

Value

A hyperframe.

Arguments

x

A hyperframe pattern (object of class "hyperframe".

subset

Logical expression indicating which points are to be kept. The expression may involve the names of columns of x and will be evaluated by with.hyperframe.

select

Expression indicating which columns of marks should be kept.

...

Arguments passed to [.hyperframe such as drop and strip.

Author

Adrian Baddeley Adrian.Baddeley@curtin.edu.au

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

and Ege Rubak rubak@math.aau.dk

Details

This is a method for the generic function subset. It extracts the subset of rows of x that satisfy the logical expression subset, and retains only the columns of x that are specified by the expression select. The result is always a hyperframe.

The argument subset determines the subset of rows that will be extracted. It should be a logical expression. It may involve the names of columns of x. The default is to keep all points.

The argument select determines which columns of x will be retained. It should be an expression involving the names of columns (which will be interpreted as integers representing the positions of these columns). For example if there are columns named A to Z, then select=D:F is a valid expression and means that columns D, E and F will be retained. Similarly select=-(A:C) is valid and means that columns A to C will be deleted. The default is to retain all columns.

Setting subset=FALSE will remove all the rows. Setting select=FALSE will remove all the columns.

The result is always a hyperframe.

See Also

subset, [.hyperframe

Examples

Run this code
 a <- subset(flu, virustype=="wt")

 aa <- subset(flu, minnndist(pattern) > 10)

 aaa <- subset(flu, virustype=="wt", select = -pattern)

Run the code above in your browser using DataLab