| convert | R Documentation |
convert recodes a data matrix from one format, used by versions of correspondence analysis,
into another (n objects by p variables, counts for distinct combinations of p variables, indicator matrix, contingency table).
convert( Xinput, input = "nbyp", output = "indicator", Jk = NULL, maxcat = NULL, varandcat = TRUE )
Xinput |
A data matrix, in the form of a data frame or similar |
input |
The format of the input matrix:
|
output |
The format of the output matrix:
|
Jk |
A list containing the number of distinct categories for each variable. |
maxcat |
The maximum category value, for use when all variables are Likert on a scale of 1 to maxcat. |
varandcat |
Flag for how to construct column names in an indicator matrix:
|
A list containing:
the output data matrix formatted according to the output argument
a list of length p containing the names of each variable
a list/array (of length p) containing the lists (of length Jk[i]) of category names for each variable
a list of length p containing the number of distinct categories for each variable
the number of variables
getBurt to obtain a Burt matrix or a subset of an existing one
getCT to obtain a contingency table (only if p=2)
getindicator to obtain an indicator matrix
getdoubled to obtain a doubled matrix if all variables are ordered categorical with numbered categories
Other conversion functions:
getBurt(),
getCT(),
getdoubled(),
getindicator()
dreamdataCT <- DreamData
dreamdatanbyplist <- convert(dreamdataCT,input="CT",output="nbyp")
dreamdatanbyp <- dreamdatanbyplist$result
## Not run:
dreamdataCTb <- table(dreamdatanbyp)
dreamdatanbypcounts <- convert(dreamdatanbyp,input="nbyp",output="nbypcounts")$result
dreamdataindicatorlist <- convert(dreamdatanbypcounts,input="nbypcounts",output="indicator")
dreamdatanbypb <- convert(dreamdataindicatorlist$result,input="indicator",
output="nbyp",Jk=dreamdataindicatorlist$Jk)$result
nishdatanbyp <- NishData
nishdataindicator <- convert(nishdatanbyp)$result
nishdataBurt <- t(nishdataindicator)%*%nishdataindicator
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.