Skip to content

HOw to achieve big vector times big dataframe in R?

3 messages · Tammy Ma, Jan van der Laan, Uwe Ligges

#
apply((t(as.matrix(b)) * a), 2, sum)

should do what you want.

Why this works; see,  
http://cran.r-project.org/doc/manuals/r-release/R-intro.html#The-recycling-rule and the paragraph before  
that.

Jan



Tammy Ma <metal_licaling at live.com> schreef:
#
On 14.03.2013 11:27, Jan van der Laan wrote:
... where colSums(.) should be faster than apply(., 2, sum),
Uwe Ligges