You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Starting with a clean R session, running RStudio 1.1.39 and R 3.3.2 on OS X Sierra, I was playing with to_factor() but the output differs from that expected. What could be going on here? I also reinstalled sjmisc via devtools so can't be a package version issue.
to_factor() converts a numeric vector into a factor with numeric levels, but keeps the value and variable labels (which get lost when using as.factor()). If you want the value labels set as factor levels, use to_label().
Starting with a clean R session, running RStudio 1.1.39 and R 3.3.2 on OS X Sierra, I was playing with
to_factor()
but the output differs from that expected. What could be going on here? I also reinstalledsjmisc
viadevtools
so can't be a package version issue.atomic [1:908] 3 3 3 4 4 4 4 4 4 4 ...
..- attr(, "names")= chr [1:4] "independent" "slightly dependent" "moderately dependent" "severely dependent"
> table(to_factor(efc$e42dep))
1 2 3 4
66 225 306 304
> barplot(table(to_factor(efc$e42dep)))
The code below works though with the output in line with the documentation:
The text was updated successfully, but these errors were encountered: