?sweep
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> [EMAIL PROTECTED]
> Sent: Thursday, November 15, 2007 10:50 AM
> To: r-
On Thu, 2007-11-15 at 17:50 +, [EMAIL PROTECTED] wrote:
> 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
If i understand your question, you can do:
x <- matrix(1:10, 2)
y <- sample(10,5)
apply(x, 1, function(.x)mapply(y, .x, FUN="*"))
On 15/11/2007, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I've got an array, say with i,jth entry = A_ij, and a vector, say with jth
> entry= v_j. I would
?sweep
b
On Nov 15, 2007, at 12:50 PM, [EMAIL PROTECTED] wrote:
> 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
>
On Nov 15, 2007 12:50 PM, <[EMAIL PROTECTED]> wrote:
> 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
>
>
5 matches
Mail list logo