Hello R people, >dim(exprs(estrogenrma)
I have an expressionSet with 8 samples and 12695 features (genes) > estrogenrma$estrogen present present absent absent present present absent absent > estrogenrma$time.h 10 10 10 10 48 48 48 48 present <- grep("present", as.character(estrogenrma$estrogen)) absent <- grep("absent", as.character(estrogenrma$estrogen)) ten <- grep("10", as.character(estrogenrma$time.h)) fortyeight <- grep("48", as.character(estrogenrma$time.h)) present.10 <- estrogenrma[, intersect(present, ten)] present.48 <- estrogenrma[, intersect(present, fortyeight)] absent.10 <- estrogenrma[, intersect(absent, ten)] absent.48 <- estrogenrma[, intersect(absent, fortyeight)] present.10, present.48, absent.10, and absent.48 are four expression sets with two samples and 12695 features. How can I make a new 2 new expressionsets, each have 12695 features and one sample where expressionset1 = (present.10 + present.48) / 2 expressionset2 = (absent.10 + absent.48) / 2 ? Thanks, Clayton ----- Original Message ----- From: "Tal Galili" <tal.gal...@gmail.com> To: "SML" <paral...@lafn.org> Cc: r-help@r-project.org Sent: Thursday, October 6, 2011 4:09:43 AM Subject: Re: [R] Mean(s) from values in different row? One way for doing it would be to combine the columns using paste and then use tapply to get the means. For example: set.seed(32341) a1 = sample(c("a","b"), 100,replace = T) a2 = sample(c("a","b"), 100,replace = T) y = rnorm(100) tapply(y,paste(a1,a2), mean) ----------------Contact Details:------------------------------------------------------- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) ---------------------------------------------------------------------------------------------- On Thu, Oct 6, 2011 at 8:40 AM, SML <paral...@lafn.org> wrote: > Hello: > > Is there a way to get a mean from values stored in different rows? > > The data looks like this: > YEAR-1, JAN, FEB, ..., DEC > YEAR-2, JAN, FEB, ..., DEC > YEAR-3, JAN, FEB, ..., DEC > > What I want is the mean(s) for just the consecutive winter months: > YEAR-1.DEC, YEAR-2.JAN, YEAR-2.FEB > YEAR-2.DEC, YEAR-3.JAN, YEAR-3.FEB > etc. > > Thanks. > > ______________________________________________ > R-help@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. > [[alternative HTML version deleted]] ______________________________________________ R-help@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. ______________________________________________ R-help@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.