On Wed, Jan 7, 2015 at 3:15 PM, Peter Langfelder
<peter.langfel...@gmail.com> wrote:
> You can create a suitable matrix bb as below (note the byrow = TRUE argument)
>
> aa<-matrix(1:30,nrow=10,ncol=3); aa
> bb<-matrix(c(100,100,1),nrow=10,ncol=3, byrow = TRUE); bb
> dim(aa)
> dim(bb)
> aa * bb
>
>
> You can also use matrix multiplication, but that;s slightly more involved:

I should add that it will also be much slower if, as you say, you do
it on a much larger scale and the dimensions of bb are large.

Peter

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to