forked from joseph-ProCogia/SAS-to-R-for-Medicine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
freqlist_example.R
36 lines (22 loc) · 1007 Bytes
/
freqlist_example.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#SAS to R - Introduction Course
#Arsenal Package - freqlist()
#ProCogia - Higher Intelligence. Deeper Insights. Smarter Decisions.
#install packages
#install.packages("arsenal")
#add library reference
library(arsenal)
#read in covid dataset
covid <- read.csv("~/OneDrive - ProCogia/Desktop/SAS to R/Presentations/SAS to R for Medicine/R Programs/covid.csv", header = TRUE)
#check dataset output
head(covid)
#freqlist() function
#good for comparing summary percentages against categorical data
covid.t <- table(covid[c("result", "demo_group","gender")])
output_fl <- freqlist(covid.t, na.options = "include")
#print output summary
summary(output_fl)
#exercise
#create a table "myfirsttable" from covid data using "result" as the response, and "payor_group", and "gender" as categories
#lets use the freqlist() function to pass in "myfirsttable" and remove na's as an option. Assign to "myfirstfl"
#print out the summary of "myfirstfl"