I have a data set containing some information about certain US states. The row names are states' names.
I want to select several states' (i.e. "AL" and "CA") information and create a new data set, but how?
I have a data set containing some information about certain US states. The row names are states' names.
I want to select several states' (i.e. "AL" and "CA") information and create a new data set, but how?
Well, you can form a vector of rownames
x <- c("AL", "CA" )
and then
df[x, ]
or directly
df[c("AL", "CA"), ]