########################################################
# I User’s Guide 9
# 2 Installation 10
# 2.1 Windows . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . 11
# 2.2 MacOS X . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
# 2.3 UNIX and Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
# 2.4 Version Compatability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
########################################################
2.2 MacOS X
2.2 MacOS X
Installing R
# 苹果操作系统,用的人很少,本人也只是在1986年初中时,隔着学校实验室的窗户看到过苹果机,没有摸过,从那以后,再也没有见过苹果机。本部分不用翻译和解释了,望谅解,把原文帧出,以供参考。
If you are using MacOS X, you may install the latest version of R (2.3.1 at this time) from the CRAN website
http://cran.us.r-project.org/bin/macosx/. At this time, Zelig is not supported for R on MacOS 8.6 through 9.x.
Installing Zelig
Once R is installed, you must install the Zelig and VGAM packages. There are several ways to do this.
1. For RAqua:
(a) 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”.)
(b) 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("MCMCpack", lib = "~/Library/R/library")
> install.packages("coda", lib = "~/Library/R/library")
> install.packages("VGAM", lib = "~/Library/R/library")
> install.packages("zoo", lib = "~/Library/R/library")
> install.packages("sandwich", 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.
(c) Alternatively, you may use the drop down menus to install Zelig. This requires three steps.
i. 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.
ii. Start R. From the drop-down menus, select the “Packages” menu and then the “Install Files from Local Files”
option.
iii. 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:
(a) 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
(b) Modify your configuration file to identify ~/Library/R/library as your R library directory. There are two ways
of doing this:
i. Open the .Renviron file (or create one, if you don’t have one) and add the following line:
R_LIBS = "~/Library/R/library"
ii. 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"
(c) 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”.)
(d) 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("MCMCpack", lib = "~/Library/R/library")
> install.packages("coda", lib = "~/Library/R/library")
> install.packages("VGAM", lib = "~/Library/R/library")
> install.packages("zoo", lib = "~/Library/R/library")
> install.packages("sandwich", 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/.
Updating Zelig
There are two ways to update Zelig.
1. We recommend that you start R and, at the R prompt, type:
> update.packages()
2. Alternatively, you may remove an old version by command by typing R CMD REMOVE Zelig at the terminal prompt. Then download and reinstall the package using the installation procedures Section 2.2 outlined above.
<未完待续>