中野智文のブログ

データ・マエショリストのメモ

自宅のMacにRを入れる

背景

Juliaを入れ直そうと思ったら、うまくいかない。

Rを入れる。

とりあえず、Rをいれればなんとかなるかもしれない。

OS XにRをインストールするときに知っておきたいこと - Qiita

にしたがって、brew で入れる方法を試すことに

$ brew tap homebrew/science
$ brew install R

==> Installing homebrew/science/r dependency: readline
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only..

For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/readline/lib
    CPPFLAGS: -I/usr/local/opt/readline/include

==> Installing homebrew/science/r dependency: gettext
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD gettext library & some software gets confused if both are in the library path.

If you need to have this software first in your PATH run:
  echo 'export PATH="/usr/local/opt/gettext/bin:$PATH"' >> ~/.bash_profile

For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/gettext/lib
    CPPFLAGS: -I/usr/local/opt/gettext/include

==> Installing homebrew/science/r
==> Caveats
To enable rJava support, run the following command:
  R CMD javareconf JAVA_CPPFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers
If you've installed a version of Java other than the default, you might need to instead use:
  R CMD javareconf JAVA_CPPFLAGS="-I/System/Library/Frameworks/JavaVM.framework/Headers -I/Library/Java/JavaVirtualMachines/jdk<version>.jdk/"
(where <version> can be found by running `java -version`, `/usr/libexec/java_home`, or `locate jni.h`), or:
  R CMD javareconf JAVA_CPPFLAGS="-I/System/Library/Frameworks/JavaVM.framework/Headers -I$(/usr/libexec/java_home | grep -o '.*jdk')"

気になるメッセージは記録しておこう。

動作確認

> binom.test(1,2)

    Exact binomial test

data:  1 and 2
number of successes = 1, number of trials = 2, p-value = 1
alternative hypothesis: true probability of success is not equal to 0.5
95 percent confidence interval:
 0.01257912 0.98742088
sample estimates:
probability of success
                   0.5

問題なし、と思う。