On Fri, Mar 4, 2011 at 12:22 PM, Sascha Vieweg <[email protected]> wrote: > Hello, I am looking for an elegant one-liner for the following operation: > > x <- rnorm(10) > y <- runif(10) > c(mean(x)-mean(y), mean(x)+mean(y)) > > I thought about > > apply(data.frame(x, y), 2, mean) > > but I don't know how to apply the +- operation on the result of apply.
Try: mean(x) + c(-1, 1) * mean(y) -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com ______________________________________________ [email protected] 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.

