Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

marks

Marks of a Point Pattern


Description

Extract or change the marks attached to a point pattern dataset.

Usage

marks(x, ...)

## S3 method for class 'ppp'
marks(x, ..., dfok=TRUE, drop=TRUE)           

## S3 method for class 'ppx'
marks(x, ..., drop=TRUE)

marks(x, ...) <- value

## S3 replacement method for class 'ppp'
marks(x, ..., dfok=TRUE, drop=TRUE) <- value

## S3 replacement method for class 'ppx'
marks(x, ...) <- value

setmarks(x, value)

x %mark% value

Arguments

x

Point pattern dataset (object of class "ppp" or "ppx").

...

Ignored.

dfok

Logical. If FALSE, data frames of marks are not permitted and will generate an error.

drop

Logical. If TRUE, a data frame consisting of a single column of marks will be converted to a vector or factor.

value

Replacement value. A vector, data frame or hyperframe of mark values, or NULL.

Details

These functions extract or change the marks attached to the points of the point pattern x.

The expression marks(x) extracts the marks of x. The assignment marks(x) <- value assigns new marks to the dataset x, and updates the dataset x in the current environment. The expression setmarks(x,value) or equivalently x %mark% value returns a point pattern obtained by replacing the marks of x by value, but does not change the dataset x itself.

For point patterns in two-dimensional space (objects of class "ppp") the marks can be a vector, a factor, or a data frame.

For general point patterns (objects of class "ppx") the marks can be a vector, a factor, a data frame or a hyperframe.

For the assignment marks(x) <- value, the value should be a vector or factor of length equal to the number of points in x, or a data frame or hyperframe with as many rows as there are points in x. If value is a single value, or a data frame or hyperframe with one row, then it will be replicated so that the same marks will be attached to each point.

To remove marks, use marks(x) <- NULL or unmark(x).

Use ppp or ppx to create point patterns in more general situations.

Value

For marks(x), the result is a vector, factor, data frame or hyperframe, containing the mark values attached to the points of x.

For marks(x) <- value, the result is the updated point pattern x (with the side-effect that the dataset x is updated in the current environment).

For setmarks(x,value) and x %mark% value, the return value is the point pattern obtained by replacing the marks of x by value.

Author(s)

Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner r.turner@auckland.ac.nz and Ege Rubak rubak@math.aau.dk

See Also

Examples

X <- amacrine
   # extract marks
   m <- marks(X)
   # recode the mark values "off", "on" as 0, 1
   marks(X) <- as.integer(m == "on")

spatstat.geom

Geometrical Functionality of the 'spatstat' Family

v2.1-0
GPL (>= 2)
Authors
Adrian Baddeley [aut, cre], Rolf Turner [aut], Ege Rubak [aut], Tilman Davies [ctb], Ute Hahn [ctb], Abdollah Jalilian [ctb], Sebastian Meyer [ctb], Suman Rakshit [ctb], Dominic Schuhmacher [ctb], Rasmus Waagepetersen [ctb]
Initial release
2021-04-15

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.