[R] What is the difference between Reduce(…) and do.call(…) ?

2013-10-08 Thread Asis Hallab
Dear R-Experts, using both do.call(…) and Reduce(…), I wonder about the differences of both. Please consider the following example: m - matrix( 1:9, ncol=3 ) lst - list( m, 2*m, 3*m ) rbind( lst ) # Returns [,1] [,2] [,3] tmp.lst Integer,9 Numeric,9 Numeric,9 do.call(

Re: [R] What is the difference between Reduce(…) and do.call(…) ?

2013-10-08 Thread Barry Rowlingson
On Tue, Oct 8, 2013 at 10:22 AM, Asis Hallab asis.hal...@gmail.com wrote: Dear R-Experts, So, what is the difference between Reduce and do.call and when best to use which? From the help: ‘Reduce’ uses a binary function to successively combine the elements of a given vector and a

Re: [R] What is the difference between Reduce(…) and do.call(…) ?

2013-10-08 Thread Uwe Ligges
Reduce will rbind 2 elements and then the result with the next element of the list --- while do.call just applies rbind once on all elements of the list at the same time. Uwe Ligges On 08.10.2013 11:22, Asis Hallab wrote: Dear R-Experts, using both do.call(…) and Reduce(…), I wonder