How to select column of dataframe using numbers

Viewed 67

At the moment I am selecting columns the usual way:

`df$column1`

But I want to loop through the columns of my dataframe into a plot function, and when I use the method:

`df[,1]`

I get the error:

Don't know how to automatically pick scale for object of type data.frame. Defaulting to continuous. Error in is.finite(x) : default method not implemented for type 'list'

So what would be the best way to select columns of the dataframe so that I can easily loop through the columns and avoid this error.

1 Answers
Related