matrix2long {TripleR} | R Documentation |
Convert a quadratic matrix to long format
Description
This function converts data from a quadratic round robin matrix into long format.
Usage
matrix2long(M, new.ids=TRUE, var.id="value")
Arguments
M |
A matrix with actors in rows and partners in columns) |
new.ids |
Should new ids for actors and partners be defined? (If new.ids=FALSE the row and column names are taken. In that case, you have to make sure, that rows and columns have the same set of names.) |
var.id |
The name of the column with the measured variable in the returned data frame |
Value
A data frame in long format
See Also
Examples
#The example data are taken from the "Mainz Freshman Study" and consist
# of ratings of liking as well as ratings of the metaperception of
# liking at zero-acquaintance using a Round-Robin group of 54 participants
# (Back, Schmukle, & Egloff, in pres)
# load a data set in matrix style
data("liking_a")
str(liking_a)
long <- matrix2long(liking_a)
str(long)
[Package TripleR version 1.5.4 Index]