var2dummy | R Documentation |
When dealing with categorical variables, the estimate
function convert the categorical variables into dummy variables.
This function convert a set of variable names to their corresponding name in the model with dummy variables
var2dummy(object, ...)
## S3 method for class 'list'
var2dummy(object, var, rm.first.factor = TRUE, ...)
## S3 method for class 'lvm'
var2dummy(object, data = NULL, ...)
object |
a |
... |
[internal] additional arguments to be passed from |
var |
[character] the variable to be transformed. |
rm.first.factor |
[logical] should the first level of each categorical variable be ignored? |
data |
[data.frame] dataset according to which the model should be updated. |
## Not run:
var2dummy <- lavaSearch2:::var2dummy
var2dummy.list <- lavaSearch2:::var2dummy.list
var2dummy.lvm <- lavaSearch2:::var2dummy.lvm
m <- lvm()
regression(m) <- c(y1,y2,y3)~u
regression(m) <- u ~ X1+X2
var2dummy(m, var = c("X1","X2"))
categorical(m,labels=c("M","F","MF")) <- ~X1
var2dummy(m, var = c("X1","X2"))
categorical(m,labels=c("1","2","3")) <- ~X2
var2dummy(m, var = c("X1","X2"))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.