How to create labels in a binary vector without it becoming categorical?

3

I have a binary variable in a dataframe , I want to assign the label "no" to the value 0 and "yes" to the value 1 without the vector becoming categorical (if this occurs, I can not use the function svymean() ).

Does anyone know if this is possible?

    
asked by anonymous 27.10.2014 / 16:41

1 answer

1

This is not possible.

What you can do is to let R transform into a factor, and when to use svymean do so:

x <- c("sim", "sim", "não", "não")
svymean(x = as.numeric(x == "sim"), design = ?)

See that using as.numeric(x == "sim") drops a vector of zeros and ones:

[1] 1 1 0 0
    
27.10.2014 / 22:07