-
-
Save naomispence/7b24ed7dcf1afb39fd8de90459bfeedf to your computer and use it in GitHub Desktop.
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
load("nycyrbs.RData") | |
nycyrbs1<-subset(nycyrbs, select = c(q33, q34, q35, grade)) | |
#rm(nycyrbs) | |
nycyrbs[nycyrbs==""]<-NA | |
library(Hmisc) | |
library(descr) | |
label(nycyrbs$q34) <-"Vape Usage" | |
label(nycyrbs$q35) <-"Recent Vape Usage" | |
freq(nycyrbs$q34) | |
freq(nycyrbs$q35) | |
label(nycyrbs$q35) <-"Recent Vape Usage" | |
# I have to load dataset first | |
# Use lowercase nycyrbs data set, not capital for consistency | |
label(nycyrbs$grade) <-"Grade Level" | |
freq(nycyrbs$grade) | |
freq(nycyrbs$q33) | |
freq(nycyrbs$q34) | |
ggplot(data = nycyrbs1, aes(x = q33)) + geom_bar(color="blue", fill="white", aes(y=(..count../sum(..count..))*100)) + | |
ggtitle("Figure #. Distribution of DESCRIBE YOUR VARIABLE")+ | |
labs(y="Percent", x="LABEL FOR YOUR VARIABLE VALUES") | |
ggplot(data = nycyrbs1, aes(x = grade)) + geom_histogram(color="blue", fill="white", aes(y=(..count../sum(..count..))*100)) + | |
ggtitle("Figure #. Distribution of DESCRIBE YOUR VARIABLE")+ | |
labs(y="Percent", x="LABEL FOR YOUR VARIABLE VALUES") | |
summary(nycyrbs1$grade) | |
sd(nycyrbs1$grade, na.rm=T) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment