Previous: Installing R Up: Windows Next: Updating Zelig

Installing Zelig

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

  1. We recommend that you start R and then type:
    > source("http://gking.harvard.edu/zelig/install.R")
    > library(Zelig)
    
  2. Alternatively, you may install each component package individually in R:
    > install.packages("Zelig")
    > install.packages("zoo")
    > install.packages("sandwich")
    > install.packages("MCMCpack")
    > install.packages("coda")
    > install.packages("lattice")
    > install.packages("mvtnorm")
    > install.packages("VGAM")
    > install.packages("sna")
    > install.packages("systemfit")
    > install.packages("nnet")
    > install.packages("gee")
    > install.packages("mgcv")
    > library(Zelig)
    
    Zelig will load the optional libraries whenever their functions are needed; it is not necessary to load any package other than Zelig at startup.

  3. Alternatively, you may use the drop down menus to install Zelig. This requires four steps.
    1. Go to the Zelig website and and download the latest release of Zelig. The VGAM, MCMCpack, coda, zoo, and sandwich packages are available from CRAN. Store these .zip files in your R program directory. For example, the default R program directory is C: 1#1 Program Files 1#1 R 1#1 R-2.5.1 1#1 .2.1
    2. Start R. From the drop-down menus, select the ``Packages'' menu and then the ``Install Files from Local Zip Files'' option.
    3. A window will pop up, allowing you to select 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.
    4. At the R prompt, type library(Zelig) to load the functionality described in this manual. Note that Zelig will automatically load the other libraries as necessary.

  4. An additional recommended but optional step is to set up R to load Zelig automatically at launch. (If you skip this step, you must type library(Zelig) at the beginning of every R session.) To automate this process, edit the Rprofile file located in the R program subdirectory (C: 1#1 Program Files 1#1 R 1#1 R-2.5.1 1#1 etc 1#1 in our example). Using a text editor such as Windows notepad, add the following line to the Rprofile file:
    options(defaultPackages = c(getOption("defaultPackages"), "Zelig"))
    

Zelig is distributed under the GNU General Public License, Version 2. After installation, the source code is located in your R library directory, which is by default C: 1#1 Program Files 1#1 R 1#1 R-2.5.1 1#1 library 1#1 Zelig 1#1 .



Gary King 2010-09-09