Install packages we’ll use

Copy and paste these two commands into the R Console window.

ADA.package.list <- c("BSDA", "GGally", "Hmisc", "MASS", "NbClust", "R.oo",
  "TeachingDemos", "VIM", "annimation", "aod", "beeswarm", "candisc", "car",
  "cluster", "corrgram", "datasets", "deducorrect", "dprep", "editrules",
  "ellipse", "ellipse", "ggmap", "ggplot2", "gridExtra", "gvlma", "heplots",
  "klaR", "lattice", "leaps", "lmPerm", "lsmeans", "lubridate", "mapproj",
  "maps", "moments", "moments", "multcomp", "mvnormtest", "nortest", "plyr",
  "popbio", "pwr", "reshape2", "rgl", "rspa", "rworldmap",
  "scales", "scatterplot3d", "sna", "stargazer", "stringdist", "stringr",
  "treemap", "vcd", "vioplot", "xtable")

install.packages(ADA.package.list, dependencies = TRUE)

Each package will be downloaded (along with package dependencies) and installed.

Installing the PDS Package

Follow these directions to install the PDS (Passion Driven Statistics) package which includes several data sets.

  1. Open R Studio.

  2. Install the devtools package by typing the following line in the console:

    install.packages("devtools", dependencies = TRUE)

    You will see R download several packages and then a line stating: The downloaded binary packages are in [a place on your computer]

    • If you run Windows, install Rtools:

      install.packages("installr")
      installr::install.Rtools()

      Then click on yes to the XML dialogue box and follow the prompts to install the most recent version of Rtools (top choice in dialog box).

    • If you run OSX on a Mac, you may already have Xcode installed. If the next command doesn’t return TRUE, then install Xcode.

  3. Check that the devtools package has all it needs to work:

    devtools::has_devel()

    You should see:

    [1] TRUE

    Note: If you don’t see TRUE, then go back to step (2) and verify that no errors were given during the installations.

  4. Install the PDS package from github:

    devtools::install_github('alanarnholt/PDS')
    • If you get an error ending with: there is no package called 'R6', then type install.packages("R6") to install the R6 package, then try the previous command again.
  5. Check that the PDS package is installed by loading the package and viewing the help file:

    library(PDS)
    ?"PDS-package"

    The following page should pop-up in the help box (on the bottom right of your screen):

PDS-package {PDS} R Documentation The PDS Package

Description

The PDS Package

  1. In the Help Box: Click on the word Index (highlighted in blue at the bottom) to view the list of datasets.

If you need further help, check out https://github.com/alanarnholt/PDS

Data Sets in PDS

AddHealth Adolescent to Adult Health (Wave I)

The National Longitudinal Study of Adolescent to Adult Health (Add Health) is a longitudinal study of a nationally representative sample of adolescents in grades 7-12 in the United States during the 1994-95 school year.

A data frame with 6504 observations on 2829 variables.

library(PDS)
dim(AddHealth)
## [1] 6504 2829

addhealth_public4 Adolescent to Adult Health (Wave 4)

The National Longitudinal Study of Adolescent to Adult Health (Add Health) is a longitudinal study of a nationally representative sample of adolescents in grades 7-12 in the United States during the 1994-95 school year.

A data frame with 6504 observations on 976 variables.

library(PDS)
dim(addhealth_public4)
## [1] 6504  976

OOL Outlook On Life Survey

The 2012 Outlook Surveys, conducted by GfK Knowledge Networks on behalf of the University of California Irvine, were designed to study political and social attitudes in the United States. The project included two surveys fielded between August and December 2012 using a sample from an Internet panel. A total of 2,294 respondents participated in this study during Wave 1 and 1,601 were interviewed during Wave 2. The target population was comprised of four groups: African American/Black males aged 18 and older, African American/Black females aged 18 and older, White/other race males aged 18 and older, and White/other race females aged 18 older, all non-institutionalized and residing in the United States. The survey considered the ways in which social class, ethnicity, marital status, feminism, religiosity, political orientation, sexual behavior, and cultural beliefs or stereotypes influence opinion and behavior. Participants were asked an array of questions pertaining to voting preference, party identification, respondent perception of opportunity for success, and views on interracial dating. These variables and questions examine political and social attitudes in the United States. Additional questions addressed issues such as common fate, nationalism, equality, discrimination, and relations with law enforcement. Demographic variables include race ethnicity, age, gender, religious involvement, sexual orientation, citizenship, annual income, and education.

A data frame with 2294 observations on 436 variables.

library(PDS)
dim(OOL)
## [1] 2294  436