how to get each column as data.frame (instead of a vector) from a data.frame?
dataframe, r, vector
Solution
Instead of calling the desired column with a comma i.e. data.frame[,i] use data.frame[i] to preserve the class as data.frame and also retain row names.
data.frame[,i] #As a vector
data.frame[i] #As a data.frame
Problem
Normally when you get a column, it is a vector. How can I keep it as the data.frame with the same row names and corresponding column name?