Re: [R] unwanted coercion using apply

From: Jeroen Ooms <>
Date: Sun, 22 May 2011 12:22:01 -0700

> apply() operates on arrays and a data frame will be coerced to a matrix
> (which requires all elements to be of the same type). This is documented in
> ?apply.

Thanks, I was not aware of that. I implicitly assumed there would be a specific

> This may not be elegant, but why not just use a loop:

The thing is that were are going to use this operation on a (very) large scale in a production environment, on datasets for which nrow >> ncol. So I would like the most efficient solution and if possibly, avoid looping over the rows.



        [[alternative HTML version deleted]] mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Sun 22 May 2011 - 19:24:53 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 22 May 2011 - 19:50:09 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive