R 在条件下删除行
我有一个如下所示的数据集:R 在条件下删除行,r,delete-row,R,Delete Row,我有一个如下所示的数据集: > head(Margin1) # A tibble: 6 x 24 # Groups: Date, Home.team, Away.team, Home.score, Away.score [3] Date Home.team Away.team Home.score Away.score Playing.for Kicks Marks Handballs Goals Goal.Assists Tackles Hit.Outs Reboun
> head(Margin1)
# A tibble: 6 x 24
# Groups: Date, Home.team, Away.team, Home.score, Away.score [3]
Date Home.team Away.team Home.score Away.score Playing.for Kicks Marks Handballs Goals Goal.Assists Tackles Hit.Outs Rebounds
<date> <chr> <chr> <int> <int> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 2017-03-23 Carlton Richmond 89 132 Carlton 215 99 133 14 8 67 50 38
2 2017-03-23 Carlton Richmond 89 132 Richmond 200 65 152 20 13 87 35 33
3 2017-03-24 Collingw~ Western ~ 86 100 Collingwood 246 118 185 12 8 67 50 27
4 2017-03-24 Collingw~ Western ~ 86 100 Western Bu~ 228 108 164 15 10 87 25 46
5 2017-03-25 Essendon Hawthorn 116 91 Essendon 256 135 172 17 11 65 31 45
6 2017-03-25 Essendon Hawthorn 116 91 Hawthorn 210 82 164 12 6 48 39 33
>头部(边缘1)
#一个tibble:6x24
#分组:日期、主队、客队、主队、得分、得分[3]
主队日期。客队。主队。得分。得分。踢球。得分标志手球进球。助攻抢断命中。出局篮板
1 2017-03-23卡尔顿里士满89 132卡尔顿215 99 133 14 8 67 50 38
2 2017-03-23卡尔顿里士满89 132里士满200 65 152 20 13 87 35 33
3 2017-03-24科林伍德西部86 100科林伍德246 118 185 12 8 67 50 27
4 2017-03-24科林GW~西部~86 100西部Bu~228 108 164 15 10 87 25 46
5 2017-03-25埃森顿山楂116 91埃森顿256 135 172 17 11 65 31 45
6 2017-03-25埃森顿山楂116 91山楂210 82 164 12 6 48 39 33
由于我只需要主队的数据,所以我只想在这些条件下删除该行(客场.team=playing.for),非常感谢您的帮助 找到了这样做的方法
Margin1 <-Margin1[!(Margin1$Away.team == Margin1$Playing.for),]
Margin1