Previous: Installing R Up: UNIX and Linux Next: Updating Zelig


Installing Zelig

Before installing Zelig, you need to create a local R library directory. If you have done so already, you can skip to Section [*]. If not, you must do so before proceeding because most users do not have authorization to install programs globally. Suppose we want the directory to be ~/.R/library. At the terminal prompt in your home directory, type:

% mkdir ~/.R ~/.R/library
Now you are ready to install Zelig. There are two ways to proceed.

  1. Recommended procedure:
    1. Open the ~/.Renviron file (or create it if it does not exist) and add the following line:
      R_LIBS = "~/.R/library"
      
      You only need to perform this step once.
    2. Start R. At the R prompt, type:
      > source("http://gking.harvard.edu/zelig/install.R")
      > library(Zelig)
      
      (You may ignore the warning messages, unless they say ``Non-zero exit status''.)
    3. Alternatively, you can avoid the warning messages by installing each component package separately and specifying the installation path:
      > install.packages("Zelig", lib = "~/Library/R/library")
      > install.packages("zoo", lib = "~/Library/R/library")
      > install.packages("sandwich", lib = "~/Library/R/library")
      > install.packages("MCMCpack", lib = "~/Library/R/library")
      > install.packages("coda", lib = "~/Library/R/library")
      > install.packages("lattice", lib = "~/Library/R/library")
      > install.packages("mvtnorm", lib = "~/Library/R/library")
      > install.packages("VGAM", lib = "~/Library/R/library")
      > install.packages("sna", lib = "~/Library/R/library")
      > install.packages("systemfit", lib = "~/Library/R/library")
      > install.packages("nnet", lib = "~/Library/R/library")
      > install.packages("gee", lib = "~/Library/R/library")
      > install.packages("mgcv", lib = "~/Library/R/library")
      > library(Zelig)
      
    4. Finally, create a .Rprofile file in your home directory, containing the line:
      library(Zelig)
      
      This will load Zelig every time you start R.

  2. Alternatively:
    1. Add the local R library directory that you created above ( ~/.R/library in the example) to the environmental variable R_LIBS.
    2. Download the latest bundles for Unix from the Zelig website, and (for the VGAM, MCMCpack, coda, sandwich, and zoo packages) from the CRAN website.
    3. If XX is the current version number, at the terminal prompt, type:
      % R CMD INSTALL Zelig_XX.tar.gz
      % R CMD INSTALL zoo_XX.tar.gz
      % R CMD INSTALL sandwich_XX.tar.gz
      % R CMD INSTALL MCMCpack_XX.tar.gz
      % R CMD INSTALL coda_XX.tar.gz
      % R CMD INSTALL lattice_XX.tar.gz
      % R CMD INSTALL mvtnorm_XX.tar.gz
      % R CMD INSTALL VGAM_XX.tar.gz
      % R CMD INSTALL sna_XX.tar.gz
      % R CMD INSTALL systemfit_XX.tar.gz
      % R CMD INSTALL nnet_XX.tar.gz
      % R CMD INSTALL gee_XX.tar.gz
      % R CMD INSTALL mgcv_XX.tar.gz
      
      % rm Zelig_XX.tar.gz zoo_XX.tar.gz sandwich_XX.tar.gz MCMCpack_XX.tar.gz coda_XX.tar.gz lattice_XX.tar.gz mvtnorm_XX.tar.gz mvtnorm_XX.tar.gz VGAM_XX.tar.gz sna_XX.tar.gz systemfit_XX.tar.gz nnet_XX.tar.gz  gee_XX.tar.gz mgcv_XX.tar.gz
      
    4. Create a .Rprofile file in your home directory, containing the line:
      library(Zelig)
      
      This will load Zelig every time you start R.

Zelig is distributed under the GNU General Public License, Version 2. After installation, the source code is located in your R library directory. If you followed the example above, this is  /.R/library/Zelig/.



Gary King 2011-11-29