Skip to content

Instantly share code, notes, and snippets.

data.aov1 <- aov(gss123$paeduc ~ gss123$race, data=gss123)
summary(data.aov1)
by(gss123$race, gss123$paeduc, mean, na.rm=T)
TukeyHSD(data.aov1)
##CHANGE VARNAME TO YOUR VARIABLE NAME; CHANGE TITLES AND X-AXIS LABELS
frequency(addhealthW5$VARNAME, title= "Frequency Distribution of YOUR VARIABLE DESCRIPTION")
#INTERPRET THE RESULT OF THE LINE ABOVE
frequency(addhealthW5$VARNAME, cumulative.percent=TRUE, title="YOUR VARIABLE DESCRIPTION")
#INTERPRET THE RESULT OF THE LINE ABOVE
ggplot(data=subset(addhealthW5, !is.na(VARNAME)), aes(x = VARNAME)) +
geom_bar(color="blue", fill="yellow", aes(y = ((..count..)/sum(..count..)))) +
scale_y_continuous(labels = scales::percent) +
ggtitle("Bar Graph of of YOUR VARIABLE DESCRIPTION, Wave 5 Add Health") +
# be sure you have the line below where you load libraries and options to load the dataset from the server.
data("addhealthW5")
#if you need to recode any of your variable values, you should do it before you label your dummy codes
addhealthW5$H5HR2[addhealthW5$H5HR2 == 6] <- 5
#the line right above this note changes the old dummy code 6 to a dummy code of 5, which combines the two groups.
#if you need to code out missing data (R calls it NA), you would use the example shown in the line below.
addhealthW5$VARNAME[addhealthW5$VARNAME == 97] <- NA
#in the line above, the number inside the ] needs to be the dummy code for missing data on your variable.
library(ggplot2)
library(dplyr)
library(lsr)
library(descr)
library(Hmisc)
library('lehmansociology')
options(scipen = 999)
data(wave5addhealth)
wave5addhealth<-wave5addhealth[wave5addhealth$H5TO6<97,]
library(ggplot2)
library(dplyr)
library(lsr)
library(descr)
library(Hmisc)
library('lehmansociology')
options(scipen = 999)
data(wave5addhealth)
#Lab Report 5: Making and Comparing Confidence Intervals
library(ggplot2)
library(dplyr)
library(lsr)
library(descr)
library(Hmisc)
library('lehmansociology')
data(gss123)
options(scipen = 999)
##Comparing CIs and distributions
#Load the libraries and data first
library(ggplot2)
library(dplyr)
library(lsr)
library(descr)
library(Hmisc)
library('lehmansociology')
data(gss123)
#START BY LOADING LIBRARIES AND OPTIONS
library(aws.s3)
library(ggplot2)
library(dplyr)
library(lsr)
library(descr)
library(Hmisc)
library('lehmansociology')
options(scipen = 999)
#Lab: Scatterplots and Regression
#Load the libraries and data first
library(ggplot2)
library(dplyr)
library(lsr)
library(descr)
library(Hmisc)
library('lehmansociology')
data(gss123)
#Lab: Scatterplots and Regression
#Load the libraries and data first
library(ggplot2)
library(dplyr)
library(lsr)
library(descr)
library(Hmisc)
library('lehmansociology')