[R] Find classes for each column of a data.frame
David Winsemius
dwinsemius at comcast.net
Thu Aug 26 17:36:57 CEST 2010
On Aug 26, 2010, at 11:31 AM, Daniel Brewer wrote:
> Hello,
>
> Is there a simple way to get the class type for each column of a
> data.frame? I am in the situation where I would like to get all the
> columns of a data.frame that are factors.
>
> I have tried:
> apply(df,2,class)
lapply(df, class)
> but all the columns come back as class "character".
Agree that is not what I would have expected.
--
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list