LoginSignup
2
1

More than 5 years have passed since last update.

MacでRの日本語処理関係

Last updated at Posted at 2018-01-11

Rの環境

macOS High Sierra 10.13.2
Homebrew 1.4.3
R 3.4.3 
RStudio 1.1.383

Rは brew install r からインストールしたもの。
RStudioは brew cask install rstudio でインストール。
caskにもGUI版の R があったが、 brew doctor で Warning 出まくりのためパス。

plotの文字化け対策

以下を参考に .Rprofile を作成。
RStudio for Mac OS X で日本語のプロットが上手くいかない場合の対処法

日本語ファイルの読み込み

Rで学ぶデータマイニング
↑勉強中のこの本のCD-ROMデータを読み込むと、マルチバイト関係のエラーが発生。
nkfで調べるとWindows用にShift JISになっているようなので、
encoding="Shift_JIS" を試すも改善されず。ファイルからの読み込みには fileEncoding="Shift_JIS" が正解の模様だが、拡張コードの fileEncoding="cp932" を指定したほうがベターかも。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1