R のインストール


  • Windows, Mac, Linux(redhat, yellowdog, vine,...), Unix のインストールのコツなどを付け足してください。 -- 2004-02-21 (土) 21:00:21
  • 2.1.0リリース記念でR-2.1.0(Windows)のインストール方法を作成してみました:-) -- 2005-04-22 (金) 00:01:19
  • PC-98x1 で Windows2000 や Unix系(含むLinux) を使用した場合にも、インストールできないということでよろしいでしょうか? -- 2005-06-17 (金) 15:27:55
  • マルチバイト非対応の UNIX でインストールするときの注意点を追加 -- 2005-06-21 (火) 18:36:57
  • 2.1.1リリース記念でR-2.1.1(Windows)のインストール方法を作成してみました:-) -- 2005-06-25 (土) 00:01:19
  • intel Mac 版の起動時点でのエラーメッセージについて,回避策を追加した -- 2007-02-14 (水) 13:37:05
  • Windows Vista特有の問題に関する記述を追加 -- 2008-07-03 (木) 20:22:35
  • 学生の初心者ですが、R 2.10.1で私も文字化けしました。 -- 学生? 2010-03-31 (水) 12:13:24


Windows 版 R のインストール

最新版はこちらから, R-2.10.1-win32.exeをダウンロードしてください。

インストーラ実行後のユーザ設定用ツールを作ってみました。初心者の方どうぞ。
"R User Configuration" http://androids.happy.nu/doc/r-tips#USER-CONFIG

  • これは便利ですね>ユーザ設定用ツール. オートが秀逸です。 -- 2007-04-03 (火) 09:55:52
  • R-2.6.0が10/3付でリリースされています。R-2.4.1(Windows)と同じ方法でインストールできました。 -- ken? 2007-10-13 (土) 16:47:06
  • 設定ツール, リンク切れになってました。 -- 2007-11-20 (火) 14:50:14
  • 設定ツール,リンクが復旧したようです。 -- 2007-11-26 (月) 23:36:10
  • R-2.10.1のインストールの際に文字化けしてしまい、とりあえずデフォルト設定のままインストールしました。なぜ文字化けしてしまったのでしょうか? -- 2010-02-17 (水) 14:01:24

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ランタイムを使っているのが原因のようです。

  • Vista64bit版にはR for win 32bitのインストールが可能ですが、利用可能メモリの上限は4Gまでです。ネイティブ対応が待ち遠しい・・・。 -- うらないし? 2008-11-27 (木) 15:22:50
  • C:\Documents and Settings\ と同根の問題は確かに2000,XPでも生じ得ますが、標準ではジャンクションを作成する手段が用意されていないので、2000,XPではまず出会うことはないでしょう。ご安心。 -- 2008-12-12 (金) 18:36:29
  • この問題、FAQには載っていません。2.24 Does R run under Windows Vista?に追記しくださいと頼んだらDr. Ripleyにあっさり却下されました -- 2008-12-12 (金) 18:40:48

Mac 版 R のインストール

http://aoki2.si.gunma-u.ac.jp/R/begin.html

Linux 版 R のインストール

Debian GNU/Linux (含む Knoppix)の場合 (インターネット経由でオリジナル版をインストールする場合)

(ADSL 等の比較的高速なインターネット接続可能状態にあることが大前提。)

  • root になる
  • エディタで /etc/apt/source.list に次の行を付け加える(最新版の場合)。 快適なダウンロードがお望みならCRAN国内ミラーの使い方を参照。 本来の Debian ソースには標準で R 関連のパッケージが含まれるから、この項は省略可能 (Debian GNU/Linux をインストールした時点で恐らく既に記載済みのはず)。注意:CRAN にある Debian パッケージは保守がされなくなっているので使わない方がよい。
     deb ftp://ftp.jp.debian.org/debian-jp stable-jp main contrib
     deb ftp://ftp.jp.debian.org/debian-jp testing-jp main contrib
     deb ftp://ftp.jp.debian.org/debian-jp unstable-jp main contrib
  • Debian パッケージリスト更新命令を実行
     apt-get update
  • 次の命令を実行。自動的に関連基本パッケージ(数値ライブラリ等も含み)が同時にインストールされ、直ちに R が使えるようになる
     apt-get install r-base
  • 関連パッケージは同様にインストール。例えば
     apt-get install r-cran-hmisc
  • バージョンアップは同様の手順でできる。古いものを削除する必要は無く、既に最新バージョンなら何も行なわれない。
  • Knoppix(-jp) の場合基本メニューにある Debian パッケージ管理ソフト KPackage を起動するとメニュー方式で個別にインストールできわかりやすい
  • ちなみに現時点での Debian.org にある R 関連のパッケージは次の通り(もちろんこれらのうちアドオンパッケージは R をインストール後、R 経由で CRAN から(最新版を)インストールすることができる)
r-baser-cran-codar-cran-lmtestr-cran-rcmdr
r-cran-vrr-noncran-lindseyr-base-corer-cran-dbi
r-cran-mapdatar-cran-rmysqlr-cran-xmlr-nonlinear
r-base-devr-cran-designr-cran-mapprojr-cran-rodbc
r-doc-htmlr-omegahat-ggobir-base-htmlr-cran-effects
r-cran-mapsr-cran-rpartr-doc-infor-omegahat-rgtk
r-base-latexr-cran-foreignr-cran-mcmcpackr-cran-rquantlib
r-doc-pdfr-pdlr-cran-abindr-cran-gtkdevice
r-cran-mgcvr-cran-statdatamlr-gnomer-recommended
r-cran-bootr-cran-hmiscr-cran-mysqlr-cran-survival
r-mathlibr-xmlr-cran-carr-cran-kernsmooth
r-cran-nlmer-cran-tkrplotr-noncran-designr-cran-cluster
r-cran-latticer-cran-qtlr-cran-tseriesr-noncran-hmisc

openSUSE10.2 Linux 版インストール

  • YaST2を立ち上げインストールソースの変更を行う。
  • 追加ボタンでhttpを選択。サーバー名に software.opensuse.org/download/science/openSUSE_10.2/を入力
  • 改めてソフトウエア管理からインストールする。
  • たぶん他のバージョンやyumを用いて/etc/yum.repos.dの変更でもできると思います。 やってませんが。
  • CRANミラーでのSuSE用r-baseのアップが遅いのですが、こちらのリポジトリにしっかりアップされていました。
  • suse10.3の場合、リポジトリをsoftware.opensuse.org/download/science/openSUSE_10.3/とすればできました。

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)

山本HP

快適なダウンロードがお望みならCRAN国内ミラーの使い方を参照。

R-2.2.0 では,特に何にもしないで,

./configure
make
make install

で無事 make できるようになった

REvolutionR(IntelMKL版R:マルチコア対応:Windows,MacOSX)

本家とは別にビルドされたマルチコア対応版R。比較的高速。
Windows版、MacOSX版あり。
REvolutionRは連邦の新型か参照

Linuxでソースからのビルド(VineLinuxを例として)

Linux の中には実行ファイルが用意されていないものがあります.その場合は Unix 版 R をインストールするのと同じ方法でソースからビルドするかと思います. 当方,VineLinux 4.2 を使っており,以下の手順でソースからのビルドを試みております.

  • ルート権限になった後,下記サイトから R-2.8.1.tar.gz をダウンロードする. http://cran.md.tsukuba.ac.jp/src/base/R-2/R-2.8.1.tar.gz
  • 「R HOME」というディレクトリを作成した後,ここで R-2.8.1.tar.gz を解凍(untar)する.
  • Linux 環境によっては「f77(g77で代替化)」「readline(もしくはreadline4)」「gcc」「c++」がない場合があるので,これらのパッケージを事前にインストールする.例えば,「g77」「c++」をインストールする場合は,ルート権限になった後,以下のコマンドを実行してパッケージをインストールする.
$ 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++
  • kterm 上で「R HOME」に移動し、下記コマンドを実行する。
$ ./configure
$ make
$ make install
  • 「./configure」実行時に以下のエラーが出る場合がある.
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

興味のある分野のパッケージを丸ごとインストールする

CRAN Task View


添付ファイル: filewin-04.png 1574件 [詳細] filewin-03.png 1505件 [詳細] filewin-02.png 1478件 [詳細] filewin-01.png 1909件 [詳細]

リロード   新規 編集 差分 添付   トップ 一覧 検索 最終更新 バックアップ   ヘルプ   最終更新のRSS
Google
WWW を検索 OKADA.JP.ORG を検索
Last-modified: 2010-03-31 (水) 12:13:24 (123d)