FIND DATA: By Journal | Sites   ANALYZE DATA: Help with R | SPSS | Stata | Excel   WHAT'S NEW? US Politics | IR | Law & Courts🎵
   FIND DATA: By Journal | Sites   WHAT'S NEW? US Politics | IR | Law & Courts🎵
WHAT'S NEW? US Politics | IR | Law & Courts🎵

Run R Code Example Online

library(poliscidata)  # run every time

# indicator variable created for each abortion variable
# this is going to run without console output
gss$abdefect.n    = as.numeric(gss$abdefect=="YES")
gss$abhlth.n 	= as.numeric(gss$abhlth  =="YES")
gss$abnomore.n	= as.numeric(gss$abnomore=="YES")
gss$abpoor.n 	= as.numeric(gss$abpoor  =="YES")
gss$abrape.n 	= as.numeric(gss$abrape  =="YES")
gss$absingle.n	= as.numeric(gss$absingle=="YES")
gss$abany.n 	= as.numeric(gss$abany   =="YES")

# individual indicators added together to create 0-7 scale
# this does not create console output
gss$abortion.scale = gss$abdefect.n + gss$abhlth.n + gss$abnomore.n +  
  gss$abpoor.n   + gss$abrape.n + gss$absingle.n + 
  gss$abany.n

# describe the additive index to see results
cat("Frequency Distribution Table:")
freqC(gss$abortion.scale, gss$wtss)