as.matrix.loca.p | R Documentation |
Conversions between loca.p class and some others classes
## S3 method for class 'loca.p'
as.matrix(x, rownames.force = NA, ...)
x |
is the object to convert to the new class object. |
rownames.force |
If True the rownames is setted |
... |
Other arguments, unused. |
Methods to convert from and to loca.p
class.
NA's values are not allowed in any of the arguments.
The matrix
or data.frame
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 weights w
.
It returns a new object of the new class.
See also loca.p
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.