R

R

RColorBrewerのblind friendlyなパレット表示 | R

library(RColorBrewer) display.brewer.all(n=NULL, type="all", select=NULL, exact.n=TRUE, colorblindFriendly=TRUE) RCo...
R

Easing function を上手く説明しているウェブページ

こちらのサイトで、Easing function がアニメーションで説明されています。 分かりやすいですね。 ちなみに Easing function とは、アニメーションの動きを制御するものです。 ご参考まで。...
R

RColorBrewerのパレット表示 | R

library(RColorBrewer) display.brewer.all(n=NULL, type="all", select=NULL, exact.n=TRUE, colorblindFriendly=FALSE) RC...
R

ggplot2で凡例だけを取り出す方法 | R

ggplotGrobを使えば凡例を取り出せます。 詳しくはこちらの記事を参照。 以前調べたときは、他のライブラリを使う必要があるとのことでしたが、ggplot2の関数だけで凡例は取り出せるようですね。 嬉しい...
R

sfパッケージで、geometryカラム(sfc)に属性(attributes)を付与する方法 | R, sf

st_sfを使います。 例: st_sf(a = 3:4, sfc) サンプル まず、geometryカラム(sfc: simple feature geometry list-column)を作成します。 ...
R

geom_text_repelでデータポイントを避けずにテキストを追加する方法 | R, ggplot2

point.padding = NAにすれば、データポイントを避けずにテキストを追加できます。 例: geom_text_repel(aes(lon, lat, label = "Tokyo"), point.padding ...
R

ggplot2で凡例の順序を逆にする方法 | R

こちらを使うと、凡例の順序を逆にできます。 guides(color = guide_legend(reverse = TRUE)) 例 通常はこちら。 library(ggplot2) ggplot(mtcars...
R

RのcaretパッケージでtuneLengthを指定(tuneGridは指定しない)したときのグリッドサーチ範囲

範囲は、caretで使う機械学習モデルによります。 getModelInfoで調べることができます。 例えばxgbTreeの場合、以下になります。 library(caret) getModelInfo("xgbTree...
R

Rでディレクトリを削除する方法

unlink(dirPath, recursive = T) 参考: how to remove the file when “permisson denied” in R? 取り急ぎ。 では。 --YouTube...
R

Rでリストに代入するときの注意点

この記事は以下ページへ移動しました。