I've spent a few hours on a problem with subsetting data frame rows based on search pattern in a vector. I'm newbie in R. Maybe it's easy, but I can't do it myself, and I can't find a solution in stackoverflow
Suppose that I've a mtcars data from R.
I want to subset rows with a few cars name for example only Mazda, Ford and Chevrolet. So I have a character vector car.names with names of cars I want to subset:
car.names <- c("Mazda", "Ford", "Chevrolet")
Question is: How to subset mtcars rows based on criteria in car.names?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…