0

I have a data set look like this:

> 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

As I only want the data from the Home team, all I want is to delete the row under these conditions (Away.team = playing.for), would appreciate all the help!

OMG C
  • 97
  • 5

1 Answers1

0

Found a way by doing this

Margin1 <-Margin1[!(Margin1$Away.team == Margin1$Playing.for),]
Ronak Shah
  • 377,200
  • 20
  • 156
  • 213
OMG C
  • 97
  • 5