LoginSignup
0
3

More than 5 years have passed since last update.

R備忘録 #dplyr

Last updated at Posted at 2018-04-13

データフレームからランダムにデータを取り出したい.

dplyr::sample_n(), dplyr::sample_frac
cucumber flesh: データフレームからランダムにデータを抽出したい
http://uribo.hatenablog.com/entry/2015/10/12/164129

データフレームからサンプルを削除したい.

dplyr::filter()
na.omit()を使うのではなくて,
dplyr::filter(data, data$factor != "NA")を使う!
理由? あとあと面倒だから!!!

Example
dataというデータセットからfactorという変数が"a"であるものを取り出してdata_fと名付ける.
data_f<- dplyr::filter(data, data$factor == "a")

データをいじる全般

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