0
0

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 3 years have passed since last update.

データフレームからのベクトルを用いたデータ抽出

Posted at

やりたいこと

noという列とキーコードという列を持つ、1000行のデータフレームがある。ここから、noをインデックスとして、あるnoリスト(ベクトル)に基づいてキーコードを取得したい。

方法

subset(data, data$no %in% nolist)

%in%を使うことによって、nolistに掲載されているインデックスnoに含まれるもののみを抽出することができる。

参考:
https://monstera.hatenadiary.jp/entry/2018/02/15/181135

0
0
2

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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?