as.spp: Convert Data To Class spp

Description Usage Arguments Details Value Methods (by class) Examples

Description

Tries to coerce any reasonable kind of data to a spherical point pattern (an object of class "spp") for use by the spherespatstat package).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
as.spp(X, ...)

## S3 method for class 'spp'
as.spp(X, ..., domain = NULL)

## S3 method for class 'data.frame'
as.spp(X, ..., domain = NULL)

## S3 method for class 'matrix'
as.spp(X, ..., domain = NULL)

## Default S3 method:
as.spp(X, ..., domain = NULL)

Arguments

X

Data which will be converted into a point pattern

...

Arguments passed to sphere if the domain is not otherwise specified.

domain

Object of class "sphericaldomain".

Details

Converts the dataset X to a point pattern (an object of class "spp").

This function is normally used to convert an existing point pattern dataset, stored in another format, to the "spp" format. To create a new point pattern from raw data such as lat,long coordinates, it is normally easier to use the creator function spp.

The dataset X may be:

The first case is typically used to change (or ensure) a specific coordinate format by specifying either the argument domain directly or indirectly using the argument coord_type which is passed to sphere through the additional arguments .... In the last three cases the default behaviour is to assume the domain is the entire sphere with coordinates of type "geo_deg" (see spp). Alternatively the domain can be specified by the argument domain or through the additional arguments ....

If X is a matrix or data frame, the first and second columns will be interpreted as the lat and long coordinates respectively. Any additional columns will be ignored.

The function as.spp is generic, with methods for the classes "spp", "matrix", "data.frame" and a default method.

Point pattern datasets can also be created by the function spp.

Value

An object of class "spp" (see spp) describing the spherical point pattern and its domain.

Methods (by class)

Examples

1
2
3
4
5
6
dom <- sphere(coord_type = "polar")
lat <- pi * c(1/4, 1/2, 3/4)
long <- 2 * pi * c(1/4, 1/2, 3/4)
X <- spp(lat, long, dom)
Y <- as.spp(X, coord_type = "geo_deg")
as.data.frame(Y)

rubak/spatstatsphere documentation built on May 28, 2019, 9:56 a.m.