Creating new dataset


I'm trying to make a new dataset with only the values of the ''Merc'' . Because this column does not have a name, I don not know how I will get this data set


mtcars[grep("^Merc", rownames(mtcars)),]

Yes thank you! This was exactly what I was looking for

if you are using tidyverse you can also do

mtcars %>% add_rownames(var = "cars")

then the rownames will become a definite column like any other (with my choice of the name 'cars')

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.