Skip to content

Instantly share code, notes, and snippets.

@rhilfi
Created December 2, 2021 14:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rhilfi/6cb730b567d23fabf89ae01cde1ed3bb to your computer and use it in GitHub Desktop.
Save rhilfi/6cb730b567d23fabf89ae01cde1ed3bb to your computer and use it in GitHub Desktop.
as.numeric(factor)_zero_one_issue
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