Remove columns from a data frame

The comma inside the square brackets

mtcars['mpg']

no comma: returns the mpg column as a data frame

mtcars[ ,'mpg']

comma: returns the mpg column as a vector

mtcars[ ,'mpg', drop=FALSE]

comma + drop argument: returns the mpg column as a data frame