Skip to content
Prev 300571 / 398503 Next

problem with using apply for dataframe

Hi Marion,
as stated in the help file ?apply coerces a data.frame object into an
array. Since an array has only one type of data, this coercion turns all
your variables into strings (because this data type can hold all
information given without loss).

If it happens that your data.frame consists only of numeric variables,
then this type suffices for the array as well, and things like sum or
mean can be applied row/columnwise.

btw:

apply(mydataframe,2,function(x)sum(x))

doesn't work either (for the same reason).

Cheers

Am 19.07.2012 11:48, schrieb Marion Wenty: