| rrpp.data.frame {RRPP} | R Documentation |
Create a data frame for lm.rrpp analysis
Description
Create a data frame for lm.rrpp analysis, when covariance or distance matrices are used
Usage
rrpp.data.frame(...)
Arguments
... |
Components (objects) to combine in the data frame. |
Details
This function is not much different than data.frame but is
more flexible to allow
distance matrices and covariance matrices to be included. Essentially,
this function creates a list,
much like an object of class data.frame is also a list. However,
rrpp.data.frame is
less concerned with coercing the list into a matrix and more concerned
with matching the number of observations (n).
It is wise to use this function with any lm.rrpp analysis so that
lm.rrpp does not have to search
the global environment for needed data.
It is assumed that multiple data sets for the same subjects are in the same order.
See lm.rrpp for examples.
Author(s)
Michael Collyer
Examples
# Why use a rrpp.data.frame?
y <- matrix(rnorm(30), 10, 3)
x <- rnorm(10)
df <- data.frame(x = x, y = y)
df
rdf <- rrpp.data.frame(x = x, y = y)
rdf # looks more like a list
is.list(df)
is.list(rdf)
d <- dist(y) # distance matrix as data
# One can try this but it will result in an error
# df <- data.frame(df, d = d)
rdf <- rrpp.data.frame(rdf, d = d) # works
fit <- lm.rrpp(d ~ x, data = rdf, iter = 99)
summary(fit)