| Previous: Loading Data | Up: Loading Data | Next: Special Cases When Loading |
Make sure that the data file is saved in your working directory. You
can check to see what your working directory is by starting R, and
typing getwd(). If you wish to use a different directory as
your starting directory, use setwd("dirpath"), where
"dirpath" is the full directory path of the directory you would
like to use as your working directory.
After setting your working directory, load data using one of the following methods:
> library(foreign) # Load the foreign package.
> stata.data <- read.dta("mydata.dta") # For Stata data.
> spss.data <- read.spss("mydata.sav", to.data.frame = TRUE) # For SPSS.
> library(Zelig) # Loads the Zelig library. > data(turnout) # Loads the turnout data.