|
R のインストール
Windows 版 R のインストール †最新版はこちらから, R-2.10.1-win32.exeをダウンロードしてください。
インストーラ実行後のユーザ設定用ツールを作ってみました。初心者の方どうぞ。
Windows Vista での問題点 †Vistaにインストールして動かないと嘆いている方はここを読んでください。 http://cran.r-project.org/bin/windows/rw-FAQ.html#Does-R-run-under-Windows-Vista_003f Vista (に限らず2000,XPでも同種の障害が生じ得ます) では、昔ながらのパス、例えば C:\Documents and Settings\<USERNAME>\My Documents 以下に本体をインストールしたり、ユーザのライブラリパスを設定したりすると、まともに動きません(たとえ英数字だけのパスであっても)。 素直に、Vistaの新しい既定のパスを使いましょう。 R-2.7.1にて確認。おバカなCランタイムを使っているのが原因のようです。
Mac 版 R のインストール †http://aoki2.si.gunma-u.ac.jp/R/begin.html Linux 版 R のインストール †Debian GNU/Linux (含む Knoppix)の場合 (インターネット経由でオリジナル版をインストールする場合) †(ADSL 等の比較的高速なインターネット接続可能状態にあることが大前提。)
openSUSE10.2 Linux 版インストール †
Ubuntu Linux の場合: †Ubuntu Linux 版のRのインストールと関連パッケージのインストールについては CRAN (のミラー)にある次の文章を参考にしてください。一度インストールすると、本体および各パッケージのバージョンアップがあると更新の注意が自動的に表示されますから、常に最新の状態にしておくことが容易です。ただし、Ubuntu Linux 自体のバージョンアップがありますのでこれは自動ではできない(?)。古いバージョンでも関連ソフトは数年間はメンテナンスがされるようです。要点をまとめておきます。いずれも端末からコマンドを入力して実行します。なお、Ubuntu にはルートモードが無く(?)、ルート権限で実行するにはコマンドの前に sudo 命令を付け加えます。 (1) /etc/apt/sources.list ファイルをルート権限で編集
(ルートパスワードの入力が求められます)
ここでは既定のエディター gedit を使います。
$ sudo gedit /etc/apt/sources.list
(2) 使用中の Ubuntu のバージョンに応じてつぎのような一行を付け加える。
(筑波大学のミラーを使う)
deb http://cran.md.tsukuba.ac.jp/bin/linux/ubuntu hardy/
deb http://cran.md.tsukuba.ac.jp/bin/linux/ubuntu gutsy/
deb http://cran.md.tsukuba.ac.jp/bin/linux/ubuntu feisty/
deb http://cran.md.tsukuba.ac.jp/bin/linux/ubuntu dapper/
(3) Ubuntu レポジトリの公開鍵を入手
$ gpg --keyserver subkeys.pgp.net --recv-key E2A11821
$ gpg -a --export E2A11821 | sudo apt-key add -
(4) R 本体と Ubuntu に用意されているパッケージのインストール
(システムにインストールするためやはりルート権限で実行)
(r-base-dev をインストールするとCやFortranがインストールされます)
$ sudo apt-get update
$ sudo apt-get install r-base
$ sudo apt-get install r-base-dev
$ sudo apt-get install r-cran-*
(5) Ubuntu に用意されていないパッケージ xxx はCRANからxxx.tar.gz ファイルを
ダウンロードし以下の命令を端末で実行
$ sudo R CMD INSTALL xxx.tar.gz
UBUNTU PACKAGES FOR R
R packages for Ubuntu on i386 and amd64 are available for all stable Desktop
releases of Ubuntu until their official end of life date. As of April 2008,
these are Hardy Heron (8.04), Gutsy Gibbon (7.10), Feisty Fawn (7.04) and Dapper
Drake (6.06). See https://wiki.ubuntu.com/Releases for details.
INSTALLATION
To obtain the latest R packages, add an entry like
deb http://<my.favorite.cran.mirror>/bin/linux/ubuntu hardy/
or
deb http://<my.favorite.cran.mirror>/bin/linux/ubuntu gutsy/
or
deb http://<my.favorite.cran.mirror>/bin/linux/ubuntu feisty/
or
deb http://<my.favorite.cran.mirror>/bin/linux/ubuntu dapper/
in your /etc/apt/sources.list file. See http://cran.r-project.org/mirrors.html
for the list of CRAN mirrors. To install the complete R system, use
sudo apt-get update
sudo apt-get install r-base
Users who need to compile packages should also install the r-base-dev package:
sudo apt-get install r-base-dev
The R packages for Ubuntu should otherwise behave like the Debian ones. For more
information, see the README file in http://cran.R-project.org/bin/linux/debian/
SUPPORTED PACKAGES
A number of R packages are available from the Ubuntu repositories with names
starting with r-cran-. Note, however, that only the packages part of the
r-recommended bundle are kept up-to-date on CRAN. Currently, these are:
r-cran-boot
r-cran-cluster
r-cran-codetools
r-cran-foreign
r-cran-kernsmooth
r-cran-lattice
r-cran-mgcv
r-cran-nlme
r-cran-rpart
r-cran-survival
r-cran-vr
The other r-cran-* packages are updated with Ubuntu releases only.
Because they rely on the installed version of R, we also provide, on an
experimental basis, up-to-date versions of the following packages:
littler
rkward
python-rpy (not on Dapper)
python-rpy-doc (not on Dapper)
Please notice that the maintainers are not necessarily users of these packages
themselves, so positive and negative feedback through the usual channels (see
below) would be appreciated.
SECURE APT
The Ubuntu archives on CRAN are signed with the key of "Vincent Goulet
<vincent.goulet@act.ulaval.ca>" with key ID E2A11821. You can fetch this key
with
gpg --keyserver subkeys.pgp.net --recv-key E2A11821
and then feed it to apt-key with
gpg -a --export E2A11821 | sudo apt-key add -
Some people have reported difficulties using this approach. The issue was usually
related to a firewall blocking port 11371. An alternative approach is to search
for the key at http://keyserver.noreply.org/ and copy the key to a plain text
file, say key.txt. Then, feed the key to apt-key with
sudo apt-key add key.txt
ADMINISTRATION AND MAINTENANCE OF R PACKAGES
The R packages part of the Ubuntu r-base and r-recommended packages are installed
into the directory /usr/lib/R/library. These can be updated using apt-get with
sudo apt-get update
sudo apt-get upgrade
The other r-cran-* packages shipped with Ubuntu are installed into the directory
/usr/lib/R/site-library.
Installing R packages not provided with Ubuntu first requires tools to compile
the packages from source. These tools are installed via the R development package
with
sudo apt-get install r-base-dev
Then a site administrator can install R packages into the directory
/usr/local/lib/R/site-library by running R as root and using the
> install.packages()
function. A routine update can then be undertaken from R using
> update.packages(lib.loc = "/usr/local/lib/R/site-library")
Individual users can install R packages into their home directory. The simplest
procedure is to create a file ~/.Renviron containing, e.g.,
R_LIBS="~/lib/R/library:${R_LIBS}"
The install.packages() and update.packages() functions will then work in directory
~/lib/R/library.
Unix 版 R のインストール †ソースからのコンパイル法 (含む Linux) †快適なダウンロードがお望みならCRAN国内ミラーの使い方を参照。 R-2.2.0 では,特に何にもしないで, ./configure make make install で無事 make できるようになった REvolutionR(IntelMKL版R:マルチコア対応:Windows,MacOSX) †本家とは別にビルドされたマルチコア対応版R。比較的高速。 Linuxでソースからのビルド(VineLinuxを例として) †Linux の中には実行ファイルが用意されていないものがあります.その場合は Unix 版 R をインストールするのと同じ方法でソースからビルドするかと思います. 当方,VineLinux 4.2 を使っており,以下の手順でソースからのビルドを試みております.
$ apt-get update $ apt-get install gcc-g77 $ apt-get install readline $ apt-get install readline4 $ apt-get install gcc $ apt-get install gcc-c++
$ ./configure $ make $ make install
configure: error: --with-readline=yes (default) and headers/libs are not available configure: error: --with-x=yes (default) and X11 headers/libs are not available その場合は,「./configure」にオプションを付けると無理やりインストールすることが出来るが・・・. ./configure --with-readline=no --with-x=no あまり望ましくないので、エラーが出た場合はconfig.logの中身を確認して足りないライブラリやヘッダを調査してインストールした上で./configureを実行すること。 (足らないライブラリとしてはXOrg-devel libpng-devel pcre-devel libjpeg-devel readline-devel ncurses-devel bzip2-devel zlib-devel などが候補に挙がる) apt-cache search XXX 等を実行して、足らないパッケージを探すこと。 ちなみに、XOrg-develとreadline-develが足りなかった場合は、以下の命令を実行する。 $ apt-get install XOrg-devel $ apt-get install readline-devel 興味のある分野のパッケージを丸ごとインストールする † |