Conversions between loca.p class and some others

Description

Methods to convert from and to loca.p class.

Usage

1
2
3
4
5
6
7
8
  ## 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 given) 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 the new class.

See Also

See also loca.p.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# A new unweighted 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)

# Show matrix
m

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