> On 23 May 2016, at 07:44 , Peter Langfelder <peter.langfel...@gmail.com> > wrote: > > or > > t(apply(v, 1, `+`, b))
Or, as you're messing with transposes anyways, use the fact that the column-wise counterpart is automagically handled by recycling: t(t(v)+b) Or, look Ma, no transposes v + rep(b, each=nrow(v)) (_always_ doublecheck the logic when you apply these and similar techniques! I have seen my share of student code where recycling had been applied along the wrong dimension of a matrix...) -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd....@cbs.dk Priv: pda...@gmail.com ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.