[R] Find classes for each column of a data.frame
David Winsemius
dwinsemius at comcast.net
Thu Aug 26 17:38:26 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)
> but all the columns come back as class "character".
Just realized it happens because of matrix coercion.
--
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list