[R] dataframe (matrix) multiplication

Christoph Scherber Christoph.Scherber at uni-jena.de
Fri Oct 14 10:39:11 CEST 2005


Dear R users,

Suppose I have 2 parts of a dataframe, say

ABCD
2143
3245
2154

(the real dataframe is 160 columns with each 120 rows)

and I want to multiply every element in [,A:B] with every element in [,C:D];
What is the most elegant way to do this?

I´ve been thinking of converting [,A:B] to a matrix, and then 
multiplying it with the inverse of [,C:D]; would that be correct?

The result should look like

E;F
8;3
12;10
10;4

Thanks very much for any suggestions
Christoph




More information about the R-help mailing list