as-methods {orloca} | R Documentation |
Methods to convert from and to loca.p
class.
## 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, ...)
x |
is the object to convert to the new class object. |
row.names |
Unused. |
optional |
Unused |
... |
Other arguments, unused. |
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.
If the arguments have valid values, it returns a new object of new class.
See also loca.p
.
# 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)