| var2fact {rgr} | R Documentation |
Rearranges data from a matrix or dataframe into a matrix where data are tagged by their variables names as factors. Used to concatenate data for display with functions tbplot.by.var and bwplot.by.var.
var2fact(xmat)
xmat |
name of the n x m data matrix or dataframe to be processed. |
If the data for only some of the variables available in an attached matrix or dataframe are to be processed use the cbind construct. Thus, temp.mat <- cbind(varname1, varname3, varname6, varname8).
xx |
a n * m by 2 matrix where each of the n * m rows contains a value that is paired with its variable name as a factor, see Note below. |
The m variables for n cases results in a n * m by 2 matrix, where [1:n, 1] contains the variable name for value[1] and [1:n, 2] contains the values for the n rows in the first column of xmat. Then rows [n+1:2n, 1] contain the variable name for value[2] and [n+1:2n, 2] contain the values for n rows in the second column, and so on.
Robert G. Garrett
## Display, convert data frame and display the result data(ms.data1) ms.data1 temp <- var2fact(ms.data1) temp