Created
December 2, 2021 14:54
-
-
Save rhilfi/6cb730b567d23fabf89ae01cde1ed3bb to your computer and use it in GitHub Desktop.
as.numeric(factor)_zero_one_issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
numeric<-sample(c(0,1), 100, replace=TRUE) | |
factor<-factor(numeric, levels=c(0,1), labels=c("nein", "Ja")) | |
mean(numeric) | |
mean(factor) | |
mean(as.numeric(factor)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment