as-methods {orloca}R Documentation

Conversions between loca.p class and some others

Description

Methods to convert from and to loca.p class.

Usage

  ## S3 method for class 'data.frame':
  as.loca.p(x, ...)
  ## S3 method for class 'matrix':
  as.loca.p(x, ...)
  ## S3 method for class 'loca.p':
  as.data.frame(x, row.names = NULL, optional = FALSE, ...)
  ## S3 method for class 'loca.p':
  as.matrix(x, ...)

Arguments

x is the object to convert to the new class object.
row.names Unused.
optional Unused
... Other arguments, unused.

Details

NA's values are not allowed in any of the arguments.

The matrix to convert into loca.p must have at least two columns. The first column will be consider as the x coordinates, the second as the y coordinates, and the third (if available) as the values of w.

The data.frame to convert into loca.p must have at least an x column for x coordinates, and an y column for y coordinates. Optionally, it can have w column, as the values of w.

Value

If the arguments have valid values, it returns a new object of new class.

See Also

See also loca.p.

Examples

# An unweighted new loca.p object
loca <- loca.p(x = c(-1, 1, 1, -1), y = c(-1, -1, 1, 1))

# Conversion to matrix
m <- as.matrix(loca)
m

# Conversion from matrix
as.loca.p(m)

[Package orloca version 2.0 Index]