Linuxの場合 (確認 Vine Linux 2.6)
Linux用のパッケージ(Red had 用RPMなど)があるので、それをインストールすると良いでしょう。
ソースからのインストール:
gcc と fortran compiler (f2c or g77)を必要とするので,
ない場合は事前にインストールする必要があります。
解凍し, configure and make (GNU tar なら以下の通り)
% tar xvfz R-2.4.1.tar.gz
% cd R-2.4.1
% ./configure
..
最終的に
R is now configured for i686-pc-linux-gnu
Source directory: .
Installation directory: /usr/local
C compiler: gcc -g -O2
C++ compiler: g++ -g -O2
Fortran compiler: g77 -g -O2
Interfaces supported: X11, tcltk
External libraries: readline
Additional capabilities: PNG, JPEG
Options enabled: R profiling
Recommended packages: yes
configure: WARNING: you cannot build info or html versions of the R
manuals
と表示されれば make の準備は終了.(上は私の環境 :Vine2.6)
fortran compiler としてf2cを指定する場合には、
%./configure --with-f2c
詳細はINSTALLを参照のこと
できたら
% make
% su <-- インストールは管理者で
# make install
# exit
make が失敗したら、fortran コンパイラの変更でたいがいうまくいきました.
インストールが成功したら、起動してみましょう
% cd <-- home へ移動
% mkdir r-work <-- R の作業ディレクトリを作成
% cd r-work
% R <-- R の起動
>
しっかり動くかちょっと動かしてみましょう。折角なので、グラフが書けるかをチェック!
> x <- c(1:5) <-- x に (1,2,3,4,5) というリストを代入
> y <- rnorm(5) <-- y に5つの正規乱数のリストを代入
> plot(x,y) <-- 散布図 図は表示できましたか?
> q() <-- R の終了
終了後, Save workspace image? [y/n/c]: と尋ねられるが, y と答えるとデータを作業ディレクトリの.RDataに保存する. 次回以降利用することができるので, 作業ディレクトリを利用する意識を持つようにするのが好ましい.