Skip to content

Instantly share code, notes, and snippets.

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/b151a31d7ef0c9e3d827ad6e5d30b226 to your computer and use it in GitHub Desktop.
Save rhilfi/b151a31d7ef0c9e3d827ad6e5d30b226 to your computer and use it in GitHub Desktop.
tabulate_absolute_and_relative_frequencies_R #R
list.of.packages <- c("summarytools")
new.packages <- list.of.packages[!(list.of.packages %in% installed.packages()[,"Package"])] # https://stackoverflow.com/questions/4090169/elegant-way-to-check-for-missing-packages-and-install-them
if(length(new.packages)) install.packages(new.packages)
summarytools::freq(models$significant) # https://cran.r-project.org/web/packages/summarytools/vignettes/Introduction.html
gender<-c(rep("men",10), rep("women", 20), rep(NA,5))
# with missings as a category
summarytools::freq(gender) # https://cran.r-project.org/web/packages/summarytools/vignettes/Introduction.html
# without missings reported
summarytools::freq(gender, report.nas=FALSE) # https://cran.r-project.org/web/packages/summarytools/vignettes/Introduction.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment