[R] determining the column index and grabbing only variables with a certain string in them
Dimitri Liakhovitski
ld7631 at gmail.com
Tue Jun 26 21:05:40 CEST 2007
Hello!
I have a data set with almost 2,000 variables (called 'Data').
I want to select only a set of variables that have a certain string in
them (e.g., "Variable") - 'Variable.1', 'Variable.2', etc. until
'Variable.20'.
2 questions:
1. How can I determine the exact column index of a variable in the
data frame if I know its exact name? (I am asking because names(Data)
allows me to see only the last 1,348 variables)
2. How can I grab only variables that have a string "Variable" in
their name using grep?
Thank you!
Dimitri
More information about the R-help
mailing list