I am dealing with a data frame as shown in this image, but with 380 rows in total
Not sure if this will help but let's say I am working on the dataframe:
df <- data.frame(c(-10:-1),c(-5:4),c(1:10))
and I would like to extract any rows that contain the number "-5" in either the first or the second column.
In the shared Image, I want to extract rows that contain "Arsenal" in either "HomeTeam" or "AwayTeam" column, however I do not know how to do so.
This is my attempt using grep()
However it shows the message below:
"Error: Can't subset columns that don't exist. x The locations 12, 39, 45, 78, 98, etc. don't exist. i There are only 7 columns."
where the mentioned locations are exactly the rows I need...
I wanted to try some other filtering functions like dplyr() but I couldn't understand how it works... And I am not even sure if it's fit for what I wanted to do.
dput(yourdata)
. We cannot copy/paste data from images. – neilfws