Skip to content
Prev 310559 / 398525 Next

Multiplying elements of a list by rows of a matrix

lapply(mapply(lapply(...))), along with making a vector out of a matrix then
making a matrix out of it again seems like a pretty long-winded way of doing
what is done by
   lapply(seq_along(X), function(i)tt[i,] %*% X[[i]])
or
   mapply(`%*%`, split(tt,row(tt))[1:3], X, SIMPLIFY=FALSE)

(The example datasets are odd - why doesn't tt have the same number of
rows as X has matrices?)

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com