LoginSignup
8
6

More than 5 years have passed since last update.

R データフレーム データ削除

Posted at

行列で指定、マイナスをつける

> d0
Age BW Sex a
1 60 66 M 1
2 70 57 F 2
3 65 78 F 3
4 23 88 M 4
5 66 90 M 5
6 77 57 M 6

4行目のデータを削除
> d1<-d0[-4,]
> d1
Age BW Sex a
1 60 66 M 1
2 70 57 F 2
3 65 78 F 3
5 66 90 M 5
6 77 57 M

さらに、1,3,6行目のデータ削除
>d2<-d1[c(-1,-3,-6),]
> d2
Age BW Sex a
2 70 57 F 2
5 66 90 M 5
6 77 57 M 6

4列目のaを削除
> d3<-d2[,-4]
> d3
Age BW Sex
2 70 57 F
5 66 90 M
6 77 57 M

8
6
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
8
6