How can we extract the classes of all the variables in a data frame into a vector in R?

r

#1

Hi,

How can we extract the classes of all the variables in my data frame into a vector?
I know we can see the classes using str() but how to extract them into a vector?

Thanks.


#2

@mukesh
Hi Mukesh,

Is this what you are looking for?
store_class=as.data.frame(sapply(your_dataframe, typeof))