I am trying to use the subset function to pick out certain lines of a data frame which contain the symbols * or +. I would like to put these entire lines of my data frame into a new data frame. I think that subset will be the best way to do this.
Below is my attempt:
nba <- read.csv('nba.csv',header=FALSE)
nba
two <- grep('\\Q*\\E',nba$V2)
one <- grep('\\Q+\\E',nba$V2)
both <- c(one,two)
allstar <- subset.data.frame(nba, both)
If anyone can give me advice thank you. I apologize if I have any formating mistakes. This is my first time on this website.
Thank you.
Note: I am working in R studio