Posit (RStudio) Tutorials
Getting proportions (%) in R shouldn’t cause you a headache
Solution: Crosstable function for posit (RStudio)
Are you tired of trying to get relative frequencies (percentages %) in R. There is a function for the package “gmodels” that can help make your life easier; Crosstable( ).
This tutorial uses an example from clinical research (the Framingham Heart Study) as the perfect example.
First steps
First go to https://www.r-project.org/ to download R and then, to https://rstudio.com/ to download the RStudio environment (based on R). All are freeware.
The Framingham Heart Study cohort is the longest-running clinical cohort (from 1948). This cohort focuses on cardiovascular disease and risk factors in the general population.
After completing the installation open your RStudio? Then, go to the console and try the following steps
Open and attach the dataset
We are going to extract a publically available version of the Framingham heart study from;
https://www.kaggle.com/amanajmera1/framingham-heart-study-dataset/version/1