[R] multiplying columns in matrix

Bert Gunter gunter.berton at gene.com
Wed Nov 16 23:46:49 CET 2011


(Assuming I get your meaning) Sounds like a homework exercise ...

The perhaps simplest way to do this is directly with a loop and
indexing. Did you think about this at all, as this seem fairly obvious
to me.

As an exercise for the reader, it can also be (very simply) done by
vectorizing the calculation, at the cost of greater memory usage.

Sorry, no further hints.

-- Bert

On Wed, Nov 16, 2011 at 1:24 PM, Eli Cohen <rfur123 at gmail.com> wrote:
> Say I have two matrixes: one is 8x28 and other 8x8
>
> I'd like to multiply, for example, first and second column from the 8x8 and
> plant them in first column of 8x28.
>
> Then take first and third of 8x8 and plant into second column of 8x28.etc.
>
>
>
> Any ideas?
>
>
>
> Thanks!
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.
>



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm



More information about the R-help mailing list