\chapter{Data Analysis Commands}\label{c:R}

\section{Command Syntax}

Once R is installed, you only need to know a few basic elements to get
started.  It's important to remember that R, like any spoken
language, has rules for proper syntax.  Unlike English, however, the
rules for intelligible R are small in number and quite precise (see
\Sref{s:syntax}).

\subsection{Getting Started}

\begin{enumerate}
\item To start R under Linux or Unix, type R at the terminal prompt or
  M-x R under ESS.
\item The R prompt is {\tt >}.
\item Type commands and hit enter to execute.  (No additional
  characters, such as semicolons or commas, are necessary at the end
  of lines.)
\item To quit from R, type \texttt{q()} and press enter.
\item The {\tt \#} character makes R ignore the rest of the line, and
  is used in this document to comment R code.
\item We highly recommend that you make a separate working directory
  or folder for each project.
\item Each R session has a workspace, or working memory, to store the
  \emph{objects} that you create or input.  These objects may be:
\begin{enumerate} 
\item \emph{values}, which include numerical, integer, character, and
  logical values;
\item \emph{data structures} made up of variables (vectors), matrices,
  and data frames; or
\item \emph{functions} that perform the desired tasks on
  user-specified values or data structures.
\end{enumerate}
\end{enumerate}

After starting R, you may at any time use Zelig's built-in help
function to access on-line help for any command.  To see help for all
Zelig commands, type {\tt help.zelig(command)}, which will take you
to the help page for all Zelig commands.  For help with a specific
Zelig or R command substitute the name of the command for the generic
{\tt command}.  For example, type {\tt help.zelig(logit)} to view
help for the logit model.

\subsection{Details}\label{s:syntax}.

Zelig uses the syntax of R, which has several essential elements:
\begin{enumerate}
\item R is case sensitive.  \texttt{Zelig}, the package or library, is
  not the same as \texttt{zelig}, the command.
  
\item R functions accept user-defined arguments: while some arguments
  are required, other optional arguments modify the function's default
  behavior.  Enclose arguments in parentheses and separate multiple
  arguments with commas.  For example, {\tt print(x)} or {\tt print(x,
    digits = 2)} prints the contents of the object {\tt x} using the
  default number of digits or rounds to two digits to the right of the decimal
  point, respectively.  You may nest commands as long as each has its
  own set of parentheses: \texttt{log(sqrt(5))} takes the square root
  of 5 and then takes the natural log.
  
\item The {\tt <-} operator takes the output of the function on the
  right and saves them in the named object on the left.  For example,
  {\tt z.out <- zelig(\dots)} stores the output from {\tt zelig()} as
  the object {\tt z.out} in your working memory.  You may use {\tt
    z.out} as an argument in other functions, view the output by
  typing {\tt z.out} at the R prompt, or save {\tt z.out} to a file
  using the procedures described in \Sref{s:save}.
  
\item You may name your objects anything, within a few constraints:
    \begin{itemize}
    \item You may only use letters (in upper or lower case) and
      periods to punctuate your variable names.
    \item You may \emph{not} use any special characters (aside from the
      period) or spaces to punctuate your variable names.
    \item Names cannot begin with numbers.  For example, R will not
      let you save an object as \texttt{1997.election} but will let
      you save \texttt{election.1997}.
    \end{itemize}
    
  \item Use the {\tt names()} command to see the contents of R
    objects, and the {\tt \$} operator to extract elements from R
    objects.  For example:
\begin{verbatim}
# Run least squares regression and save the output in working memory:  
> z.out <- zelig(y ~ x1 + x2, model = "ls", data = mydata)
# See what's in the R object: 
> names(z.out)
 [1] "coefficients"  "residuals"  "effects"  "rank"
# Extract and display the coefficients in z.out: 
> z.out$coefficients 
\end{verbatim} %$
    
  \item All objects have a class designation which tells R how to
    treat it in subsequent commands.  An object's class is generated
    by the function or mathematical operation that created it.
    
  \item To see a list of all objects in your current workspace, type:
    \texttt{ls()}.  You can remove an object permanently from memory
    by typing \texttt{remove(goo)} (which deletes the object {\tt
      goo}), or remove all the objects with {\tt remove(list = ls())}.
  
  \item To run commands in a batch, use a text editor (such as the
  Windows R script editor or emacs) to compose your R commands, and
  save the file with a {\tt .R} file extension in your working
  directory.  To run the file, type \texttt{source("Code.R")} at the R
  prompt.
\end{enumerate}

If you encounter a syntax error, check your spelling, case,
parentheses, and commas.  These are the most common syntax errors, and
are easy to detect and correct with a little practice.  If you
encounter a syntax error in batch mode, R will tell you the line on
which the syntax error occurred.

\section{Data Sets}

\subsection{Data Structures}

Zelig uses only three of R's many data structures: 
\begin{enumerate}
\item A {\bf variable} is a one-dimensional vector of length $n$.
\item A {\bf data frame} is a rectangular matrix with $n$ rows and $k$
  columns.  Each column represents a variable and each row an
  observation.  Each variable may have a different class.  (See
  \Sref{variable.classes} for a list of classes.)  You may refer to
  specific variables from a data frame using, for example, {\tt
    data\$variable}.
\item A {\bf list} is a combination of different data structures.  For
  example, {\tt z.out} contains both {\tt coefficients} (a vector) and
  {\tt data} (a data frame).  Use {\tt names()} to view the elements
  available within a list, and the {\tt \$} operator to refer to an
  element in a list.
\end{enumerate}

For a more comprehensive introduction, including ways to manipulate
these data structures, please refer to Chapter \ref{a:R}.

\subsection{Loading Data}\label{load.data}

Datasets in Zelig are stored in ``data frames.'' In this section, we
explain the standard ways to load data from disk into memory, how to
handle special cases, and how to verify that the data you loaded is
what you think it is.

\subsubsection*{Standard Ways to Load Data}

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 {\tt getwd()}.  If you wish to use a different directory as
your starting directory, use \verb|setwd("dirpath")|, where
\verb|"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:  

\begin{enumerate}
\item If your dataset is in a \textbf{tab- or space-delimited .txt
    file}, use \texttt{read.table("mydata.txt")}
\item If your dataset is \textbf{a comma separated table}, use
  \texttt{read.csv("mydata.csv")}.
\item To import {\bf SPSS, Stata, and other data files}, use the
  foreign package, which automatically preserves field characteristics
  for each variable.  Thus, variables classed as dates in Stata are
  automatically translated into values in the date class for R.  For
  example:
\begin{verbatim}
> 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.
\end{verbatim}
\item To load data in R format, use {\tt load("mydata.RData")}.  
\item For sample data sets included with R packages such as Zelig, you
  may use the {\tt data()} command, which is a shortcut for loading
  data from the sample data directories.  Because the locations of
  these directories vary by installation, it is extremely difficult to
  locate sample data sets and use one of the three preceding methods;
  {\tt data()} searches all of the currently used packages and loads
  sample data automatically.  For example:
\begin{verbatim}
> library(Zelig)                              # Loads the Zelig library. 
> data(turnout)                               # Loads the turnout data.
\end{verbatim}
\end{enumerate}

\subsubsection*{Special Cases When Loading Data}

These procedures apply to any of the above {\tt read} commands:
\begin{enumerate}
\item If your file uses the \textbf{first row to identify variable
    names}, you should use the option \texttt{header = TRUE} to import
  those field names.  For example,
\begin{verbatim}  
> read.csv("mydata.csv", header = TRUE)
\end{verbatim}
  will read the words in the first row as the variable names and the
  subsequent rows (each with the same number of values as the first)
  as observations for each of those variables. If you have additional
  characters on the last line of the file or fewer values in one of
  the rows, you need to edit the file before attempting to read the
  data.
\item The R missing value code is \texttt{NA}.  If this value is in
  your data, R will recognize your missing values as such.  If you
  have instead used a place-holder value (such as -9) to represent
  missing data, you need to tell R this on loading the data:
\begin{verbatim}
> read.table("mydata.tab", header = TRUE, na.strings = "-9")
\end{verbatim}
  Note: You must enclose your place holder values in quotes.
\item Unlike Windows, the file extension in R does not determine the
  default method for dealing with the file.  For example, if your data
  is tab-delimited, but saved as a {\tt .sav} file,
  \texttt{read.table("mydata.sav")} will load your data into R.
\end{enumerate}

\subsubsection*{Verifying You Loaded The Data Correctly}

Whichever method you use, try the \texttt{names()}, \texttt{dim()},
and \texttt{summary()} commands to verify that the data was properly
loaded.  For example,
\begin{verbatim}
> data <- read.csv("mydata.csv", header = TRUE)             # Read the data.
> dim(data)                    # Displays the dimensions of the data frame
[1] 16000  8                   #  in rows then columns.   
> data[1:10,]                  # Display rows 1-10 and all columns.
> names(data)                  # Check the variable names.
[1] "V1" "V2" "V3"             # These values indicate that the variables  
                               #  weren't named, and took default values.
> names(data) <- c("income", "educate", "year")     # Assign variable names. 
> summary(data)                # Returning a summary for each variable.  
\end{verbatim}
In this case, the {\tt summary()} command will return the maximum,
minimum, mean, median, first and third quartiles, as well as the
number of missing values for each variable.

\subsection{Saving Data}\label{s:save}

Use \texttt{save()} to write data or any object to a file in your
working directory.  For example,
\begin{verbatim}
> save(mydata, file = "mydata.RData")     # Saves `mydata' to `mydata.RData'
                                          #  in your working directory.  
> save.image()                            # Saves your entire workspace to
                                          #  the default `.RData' file.
\end{verbatim}
R will also prompt you to save your workspace when you use the
\texttt{q()} command to quit.  When you start R again, it will load
the previously saved workspace.  Restarting R will not, however, load
previously used packages.  You must remember to load Zelig at the
beginning of every R session.

Alternatively, you can recall individually saved objects from .RData
files using the {\tt load()} command.  For example,
\begin{verbatim}
> load("mydata.RData") 
\end{verbatim}
loads the objects saved in the {\tt mydata.RData} file.  You may save
a data frame, a data frame and associated functions, or other R
objects to file.

\section{Variables}

\subsection{Classes of Variables}

R variables come in several types.  Certain Zelig models require
dependent variables of a certain class of variable.  (These are
documented under the manual pages for each model.)  Use {\tt
  class(variable)} to determine the class of a variable or {\tt
  class(data\$variable)} for a variable within a data frame.  %$

\subsubsection*{Types of Variables} \label{variable.classes}

For all types of variable (vectors), you may use the {\tt c()} command
to ``concatenate'' elements into a vector, the {\tt :} operator to
generate a sequence of integer values, the {\tt seq()} command to
generate a sequence of non-integer values, or the {\tt rep()} function
to repeat a value to a specified length.  In addition, you may use the
{\tt <-} operator to save variables (or any other objects) to the
workspace.  For example:
\begin{verbatim}
> logic <- c(TRUE, FALSE, TRUE, TRUE, TRUE) # Creates `logic' (5 T/F values).
> var1 <- 10:20                             # All integers between 10 and 20.  
> var2 <- seq(from = 5, to = 10, by = 0.5)  # Sequence from 5 to 10 by 
                                            #  intervals of 0.5. 
> var3 <- rep(NA, length = 20)              # 20 `NA' values.  
> var4 <- c(rep(1, 15), rep(0, 15))         # 15 `1's followed by 15 `0's.  
\end{verbatim} 
For the {\tt seq()} command, you may alternatively specify {\tt
  length} instead of {\tt by} to create a variable with a specific
number (denoted by the {\tt length} argument) of evenly spaced
elements.

\begin{enumerate}
\item \textbf{Numeric} variables are real numbers and the default
  variable class for most dataset values.  You can perform any type of
  math or logical operation on numeric values.  If {\tt var1} and {\tt
    var2} are numeric variables, we can compute
\begin{verbatim}
> var3 <- log(var2) - 2*var1      # Create `var3' using math operations.
\end{verbatim} 
  \texttt{Inf} (infinity), \texttt{-Inf} (negative infinity),
  \texttt{NA} (missing value), and \texttt{NaN} (not a number) are
  special numeric values on which most math operations will fail.
  (Logical operations will work, however.)  Use {\tt as.numeric()} to
  transform variables into numeric variables.  Integers are a special
  class of numeric variable.
  
\item \textbf{Logical} variables contain values of either
  \texttt{TRUE} or \texttt{FALSE}.  R supports the following logical
  operators: {\tt ==}, exactly equals; {\tt >}, greater than; {\tt <},
  less than; {\tt >=}, greater than or equals; {\tt <=}, less than or
  equals; and {\tt !=}, not equals.  The {\tt =} symbol is \emph{not}
  a logical operator.  Refer to \Sref{logical} for more detail on
  logical operators.  If {\tt var1} and {\tt var2} both have $n$
  observations, commands such as
\begin{verbatim}
> var3 <- var1 < var2
> var3 <- var1 == var2
\end{verbatim}
  create $n$ {\tt TRUE}/{\tt FALSE} observations such that the $i$th
  observation in {\tt var3} evaluates whether the logical statement is
  true for the $i$th value of {\tt var1} with respect to the $i$th
  value of {\tt var2}.  Logical variables should usually be converted
  to integer values prior to analysis; use the {\tt as.integer()}
  command.
  
\item \textbf{Character} variables are sets of text strings.  Note
  that text strings are always enclosed in quotes to denote that the
  string is a value, not an object in the workspace or an argument for
  a function (neither of which take quotes).  Variables of class
  character are not normally used in data analysis, but used as
  descriptive fields.  If a character variable is used in a
  statistical operation, it must first be transformed into a factored
  variable.
  
\item \textbf{Factor} variables may contain values consisting of
  either integers or character strings.  Use {\tt factor()} or {\tt
    as.factor()} to convert character or integer variables into factor
  variables.  Factor variables separate unique values into levels.
  These levels may either be ordered or unordered.  In practice, this
  means that including a factor variable among the explanatory
  variables is equivalent to creating dummy variables for each level.
  In addition, some models (ordinal logit, ordinal probit, and
  multinomial logit), require that the dependent variable be a factor
  variable.
\end{enumerate}

\subsection{Recoding Variables}

Researchers spend a significant amount of time cleaning and recoding
data prior to beginning their analyses.  R has several procedures to
facilitate the process.

\subsubsection*{Extracting, Replacing, and Generating New Variables}

While it is not difficult to recode variables, the process is prone to
human error.  Thus, we recommend that before altering the data, you
save your existing data frame using the procedures described
in~\Sref{s:save}, that you only recode one variable at a time, and
that you recode the variable outside the data frame and then return it
to the data frame.

To extract the variable you wish to recode, type:
\begin{verbatim}
> var <- data$var1               # Copies `var1' from `data', creating `var'.
\end{verbatim} %$
Do \emph{not} sort the extracted variable or delete observations from
it.  If you do, the $i$th observation in {\tt var} will no longer
match the $i$th observation in {\tt data}.

To replace the variable or generate a new variable in the data frame,
type: \label{insert}
\begin{verbatim}
> data$var1 <- var                # Replace `var1' in `data' with `var'.  
> data$new.var <- var             # Generate `new.var' in `data' using `var'. 
\end{verbatim}

To remove a variable from a data frame (rather than replacing one
variable with another): 
\begin{verbatim}
> data$var1 <- NULL
\end{verbatim} %$

\subsubsection*{Logical Operators}\label{logical}

R has an intuitive method for recoding variables, which relies on
logical operators that return statements of {\tt TRUE} and {\tt
  FALSE}.  A mathematical operator (such as {\tt ==}, {\tt !=}, {\tt
  >}, {\tt >=} {\tt <}, and {\tt <=}) takes two objects of equal
dimensions (scalars, vectors of the same length, matrices with the
same number of rows and columns, or similarly dimensioned arrays) and
compares every element in the first object to its counterpart in the
second object.

\begin{itemize}
\item {\tt ==}: checks that one variable ``exactly equals'' another in
  a list-wise manner.  For example:
\begin{verbatim}
> x <- c(1, 2, 3, 4, 5)                # Creates the object `x'.
> y <- c(2, 3, 3, 5, 1)                # Creates the object `y'.  
> x == y                               # Only the 3rd `x' exactly equals
  [1] FALSE FALSE  TRUE FALSE FALSE    #  its counterpart in `y'.  
\end{verbatim} 
(The {\tt =} symbol is \emph{not} a logical operator.)

\item {\tt !=}: checks that one variable does not equal the other in a
  list-wise manner. Continuing the example:
\begin{verbatim}
> x != y
  [1]  TRUE  TRUE FALSE  TRUE  TRUE
\end{verbatim}
  
\item {\tt >} ({\tt >=}): checks whether each element in the left-hand
  object is greater than (or equal to) every element in the right-hand
  object.  Continuing the example from above:
\begin{verbatim}
> x > y                                   # Only the 5th `x' is greater
  [1] FALSE FALSE FALSE FALSE  TRUE       #  than its counterpart in `y'.
> x >= y                                  # The 3rd `x' is equal to the    
  [1] FALSE FALSE  TRUE FALSE  TRUE       #  3rd `y' and becomes TRUE.  
\end{verbatim}
  
\item {\tt <} ({\tt <=}): checks whether each element in the left-hand
  object is less than (or equal to) every object in the right-hand
  object.  Continuing the example from above:
\begin{verbatim}
> x < y                           # The elements 1, 2, and 4 of `x' are 
[1]  TRUE  TRUE FALSE  TRUE FALSE #  less than their counterparts in `y'. 
> x <= y                          # The 3rd `x' is equal to the 3rd `y'
[1]  TRUE  TRUE  TRUE  TRUE FALSE #  and becomes TRUE.  
\end{verbatim}
\end{itemize}
For two vectors of five elements, the mathematical operators compare
the first element in {\tt x} to the first element in {\tt y}, the
second to the second and so forth.  Thus, a mathematical comparison of
{\tt x} and {\tt y} returns a vector of five {\tt TRUE}/{\tt FALSE}
statements.  Similarly, for two matrices with 3 rows and 20 columns
each, the mathematical operators will return a $3 \times 20$ matrix of
logical values.

There are additional logical operators which allow you to combine and
compare logical statements:
\begin{itemize}
\item {\tt \&}: is the logical equivalent of ``and'', and evaluates
one array of logical statements against another in a list-wise manner,
returning a {\tt TRUE} only if both are true in the same location.  For example:
\begin{verbatim}
> a <- matrix(c(1:12), nrow = 3, ncol = 4)      # Creates a matrix `a'.  
> a
     [,1] [,2] [,3] [,4]
[1,]    1    4    7   10
[2,]    2    5    8   11
[3,]    3    6    9   12
> b <- matrix(c(12:1), nrow = 3, ncol = 4)      # Creates a matrix `b'.  
> b
     [,1] [,2] [,3] [,4]
[1,]   12    9    6    3
[2,]   11    8    5    2
[3,]   10    7    4    1
> v1 <- a > 3                    # Creates the matrix `v1' (T/F values). 
> v2 <- b > 3                    # Creates the matrix `v2' (T/F values). 
> v1 & v2                        # Checks if the (i,j) value in `v1' and 
      [,1] [,2] [,3]  [,4]       #  `v2' are both TRUE.  Because columns 
[1,] FALSE TRUE TRUE FALSE       #  2-4 of `v1' are TRUE, and columns 1-3
[2,] FALSE TRUE TRUE FALSE       #  of `var2' are TRUE, columns 2-3 are
[3,] FALSE TRUE TRUE FALSE       #  TRUE here.  
> (a > 3) & (b > 3)              # The same, in one step.  
\end{verbatim}
  For more complex comparisons, parentheses may be necessary to
  delimit logical statements.
  
\item {\tt |}: is the logical equivalent of ``or'', and evaluates in a
list-wise manner whether either of the
  values are {\tt TRUE}.  Continuing the example from above:
\begin{verbatim}
> (a < 3) | (b < 3)                # (1,1) and (2,1) in `a' are less
      [,1]  [,2]  [,3]  [,4]       #  than 3, and (2,4) and (3,4) in
[1,]  TRUE FALSE FALSE FALSE       #  `b' are less than 3; | returns
[2,]  TRUE FALSE FALSE  TRUE       #  a matrix with `TRUE' in (1,1),
[3,] FALSE FALSE FALSE  TRUE       #  (2,1), (2,4), and (3,4).  
\end{verbatim}
\end{itemize}
The {\tt \&\&} (if and only if) and {\tt ||} (either or) operators are
used to control the command flow within functions.  The {\tt \&\&}
operator returns a {\tt TRUE} only if every element in the comparison
statement is true; the {\tt ||} operator returns a {\tt TRUE} if any
of the elements are true.  Unlike the {\tt \&} and {\tt |} operators,
which return arrays of logical values, the {\tt \&\&} and {\tt ||}
operators return only one logical statement irrespective of the
dimensions of the objects under consideration.  Hence, {\tt \&\&} and
{\tt ||} are logical operators which are \emph{not} appropriate for
recoding variables.

\subsubsection*{Coding and Recoding Variables}

R uses vectors of logical statements to indicate how a variable should
be coded or recoded.  For example, to create a new variable {\tt var3}
equal to 1 if {\tt var1} $<$ {\tt var2} and 0 otherwise:
\begin{verbatim}
> var3 <- var1 < var2               # Creates a vector of n T/F observations.
> var3 <- as.integer(var3)          # Replaces the T/F values in `var3' with 
                                    #  1's for TRUE and 0's for FALSE.  
> var3 <- as.integer(var1 < var2)   # Combine the two steps above into one.
\end{verbatim}

In addition to generating a vector of dummy variables, you can also
refer to specific values using logical operators defined in
\Sref{logical}.  For example:
\begin{verbatim}
> v1 <- var1 == 5                     # Creates a vector of T/F statements.
> var1[v1] <- 4                       # For every TRUE in `v1', replaces the 
                                      #  value in `var1' with a 4.  
> var1[var1 == 5] <- 4                # The same, in one step.  
\end{verbatim}
The index (inside the square brackets) can be created with reference
to other variables.  For example,
\begin{verbatim}
> var1[var2 == var3] <- 1  
\end{verbatim}
replaces the $i$th value in {\tt var1} with a 1 when the $i$th value
in {\tt var2} equals the $i$th value in {\tt var3}.  If you use {\tt
  =} in place of {\tt ==}, however, you will replace all the values in
{\tt var1} with 1's because {\tt =} is another way to assign
variables.  Thus, the statement {\tt var2 = var3} is of course true.

Finally, you may also replace any (character, numerical, or logical)
values with special values (most commonly, {\tt NA}).
\begin{verbatim}
> var1[var1 == "don't know"] <- NA   # Replaces all "don't know"'s with NA's.
\end{verbatim}

After recoding the {\tt var1} replace the old {\tt data\$var1} with
the recoded {\tt var1}: {\tt data\$var1 <- var1}.  You may combine the
recoding and replacement procedures into one step.  For example:
\begin{verbatim}
> data$var1[data$var1 =< 0] <- -1
\end{verbatim}

Alternatively, rather than recoding just specific values in variables,
you may calculate new variables from existing variables.  For example,
\begin{verbatim}
> var3 <- var1 + 2 * var2   
> var3 <- log(var1)         
\end{verbatim}
After generating the new variables, use the assignment mechanism {\tt
  <-} to insert the new variable into the data frame.

In addition to generating vectors of dummy variables, you may
transform a vector into a matrix of dummy indicator variables.  For
example, see \Sref{dummy} to transform a vector of $k$ unique values
(with $n$ observations in the complete vector) into a $n \times k$
matrix.

\subsubsection*{Missing Data} 

To deal with missing values in some of your variables:
\begin{enumerate}
\item You may generate multiply imputed datasets using
  \hlink{Amelia}{http://gking.harvard.edu/stats.shtml\#amelia} (or
  other programs).
\item You may omit missing values.  Zelig models automatically apply
  list-wise deletion, so no action is required to run a model.  To
  obtain the total number of observations or produce other summary
  statistics using the analytic dataset, you may manually omit
  incomplete observations.  To do so, first create a data frame
  containing only the variables in your analysis.  For example:
\begin{verbatim}
> new.data <- cbind(data$dep.var, data$var1, data$var2, data$var3)
\end{verbatim}
  The {\tt cbind()} command ``column binds'' variables into a data
  frame.  (A similar command {\tt rbind()} ``row binds'' observations
  with the same number of variables into a data frame.)  To omit
  missing values from this new data frame:
\begin{verbatim}
> new.data <- na.omit(new.data)
\end{verbatim}
  If you perform {\tt na.omit()} on the full data frame, you risk
  deleting observations that are fully observed in your experimental
  variables, but missing values in other variables.  Creating a new
  data frame containing only your experimental variables usually
  increases the number of observations retained after {\tt na.omit()}.
\end{enumerate}

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: "zelig"
%%% End: 
