R error in data.frame : undefined columns selected

For me, R error undefined columns selected appears when I try to select some of the columns to keep in the data frame. It is easy to solve. You have to search for the misspelled column name, but if there is a long list of column names, then here is how to do that quickly.

Here is an example with the R built-in dataset Iris. If I’m trying to select columns to keep by column names with typos, then there are undefined columns selected error.

The next thing is the mismatch detection. Here is an example of how to subset in R all column names from the list.

In case of a lengthy list of column names, this might be good enough.


If you want to know how to reflow your code or other useful RStudio tips and tricks, take a look at this post.

0 comments on “R error in data.frame : undefined columns selected

Leave a Reply

Your email address will not be published. Required fields are marked *