Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It only takes a minute to sign up. Finding the column index by its name in R [closed] In a data frame, I would like to get the column's index by name. R stores the row and column names in an attribute called dimnames. Use the dimnames() function to extract or set those values. Using names as indices. These row and column names can be used just like you use names for values in a vector. You can use these names instead of the index number to select values from a vector. As R user you will agree: To rename column names is one of the most often applied data manipulations in R. However, depending on your specific data situation, a different R syntax might be needed. However, depending on your specific data situation, a different R syntax might be needed.