Previous: Installing R Up: MacOS X Next: Updating Zelig


Installing Zelig

Once R is installed, you must install the Zelig and VGAM packages. There are several ways to do this.

  1. For RAqua:
    1. We recommend that you start R, and then type:
      > source("http://gking.harvard.edu/zelig/install.R")
      > library(Zelig)
      
      (You may ignore the warning messages, unless they say ``Non-zero exit status''.)
    2. Alternatively, to avoid the warning messages, you need to install each package individually and specify the specific 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)
      
      where ~/Library/R/library is the default local library directory. Zelig will load the other libraries whenever their functions are needed; it is not necessary to load these packages at startup.

    3. Alternatively, you may use the drop down menus to install Zelig. This requires three steps.
      1. Go to the Zelig website and download the latest release of Zelig. The VGAM, MCMCpack, coda, zoo, and sandwich packages are available from CRAN. Save these .tar.gz files in a convenient place.
      2. Start R. From the drop-down menus, select the ``Packages'' menu and then the ``Install Files from Local Files'' option.
      3. A window will pop up, allowing you to select the one of the downloaded files for installation. There is no need to unzip the files prior to installation. Repeat and select the other downloaded file for installation.

  2. For command line R:
    1. Before installing command line R, you need to create a local R library directory. If you have done so already, you may skip to the next step. Otherwise, at the terminal prompt in your home directory, type:
      % mkdir ~/Library/R ~/Library/R/library
      
    2. Modify your configuration file to identify ~/Library/R/library as your R library directory. There are two ways of doing this:
      1. Open the .Renviron file (or create one, if you don't have one) and add the following line:
         
        R_LIBS = "~/Library/R/library"
        
      2. Alternatively, you may modify your shell configuration file. For a Bash shell, open your .bashrc file and add the following line:
        export R_LIBS="$HOME/Library/R/library"
        
    3. Start R and at the 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''.)
    4. Alternatively, to avoid the warning messages, you need to install each component package separately and specify 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)
      
      Although the lib argument is optional, we recommend that you set it to the default RAqua directory ("~/Library/R/library"), in case you later decide to install the RAqua GUI (which has a different default directory).

At the R prompt, type library(Zelig) to load the functionality described in this manual. Note that Zelig will automatically load the other packages as necessary.

Zelig is distributed under the GNU General Public License, Version 2. After installation, the source code is located in your R library directory, ~/Library/R/library/Zelig/.



Gary King 2011-11-29