5
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Rのいつもの呪文はsnippetで

Posted at

RStudio でスクリプトを書く時はいつも以下を先頭に書くようにしている。これで mac でも plot/ggplot2 でちゃんと日本語が出る。いつも書くので、RStudio の Tools > Global Options... > Code > Enable code snippets の横の Edit snippets で登録しておく。以下をそのまま、コメントも空行も含めて登録できる。素晴らしい。日本語も問題ない。以下、自分のための備忘録として。「Rをはじめよう」からだいぶ拡張。

# 
# ○○の解析
# 解析対象:
# 解析方法:
# 
# 2019/01/01 Daisuke TOMINAGA

library(tidyverse);
library(ggfortify);                                   # lm()/glm() で autoplot() したいから
rm(list=ls());                                        # スクリプティング試行錯誤用
par(family = "HiraKakuProN-W3");                      # plot() で日本語 on mac
theme_set(theme_bw(base_family = "HiraKakuProN-W3")); # ggplot で日本語

RStudio_global_options_code.png
RStudio_edit_snippet.png

5
3
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
5
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?