Rearranges Data for Variables as Factors
Rearranges data from a matrix or data frame into a matrix where data are tagged by their variables names as factors. Used to concatenate data for display with functions tbplots.by.var
and bwplots.by.var
.
var2fact(xmat)
xmat |
name of the |
If the data for only some of the variables available in an attached matrix or data frame are to be processed use the cbind
construct. Thus, temp.mat <- cbind(vname1, vname3, vname6, vname8)
.
xx |
a |
The p
variables for n
cases results in a n * p
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 ## Clean-up rm(temp)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.