[R] Multiply each column of array by vector component

Greg Snow Greg.Snow at intermountainmail.org
Thu Nov 15 19:00:40 CET 2007


?sweep

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at intermountainmail.org
(801) 408-8111
 
 

> -----Original Message-----
> From: r-help-bounces at r-project.org 
> [mailto:r-help-bounces at r-project.org] On Behalf Of 
> M.T.Charemza at warwick.ac.uk
> Sent: Thursday, November 15, 2007 10:50 AM
> To: r-help at r-project.org
> Subject: [R] Multiply each column of array by vector component
> 
> Hi,
> 
> I've got an array, say with i,jth entry = A_ij, and a vector, 
> say with jth entry= v_j. I would like to multiply each column 
> of the array by the corresponding vector component, i,e. find 
> the array with i,jth entry
> 
> A_ij * v_j
> 
> This seems so basic but I can't figure out how to do it 
> without a loop.
> Any suggestions?
> 
> Michal.
> 
> ______________________________________________
> 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.
> 



More information about the R-help mailing list