Skip to content
Prev 313033 / 398503 Next

data manipulation between vector and matrix

HI,
In addition to ?sweep(), you can use

apply(-mat,1,`+`,x) 

#or
library(plyr)
aaply(-mat,1,"+",x) 


A.K.






----- Original Message -----
From: C W <tmrsg11 at gmail.com>
To: Sarah Goslee <sarah.goslee at gmail.com>
Cc: r-help <r-help at r-project.org>
Sent: Wednesday, December 5, 2012 1:51 PM
Subject: Re: [R] data manipulation between vector and matrix

Thanks, Sarah.? First time heard about sweep(), it worked just the way I
wanted.
Mike
On Wed, Dec 5, 2012 at 1:42 PM, Sarah Goslee <sarah.goslee at gmail.com> wrote:

            
??? [[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.