<Richard.Cotton <at> hsl.gov.uk> writes: [snip] > Try: > nrows <- 5 > mm <- matrix(rnorm(30),nrow=nrows) > sd.by.col <- apply(mm,2,sd) > mean.by.col <- apply(mm,2,mean) > values <- 1-mapply(pnorm, q=as.vector(mm), mean=rep(mean.by.col, > nrows)), sd=rep(sd.by.col, nrows))) values <- matrix(values, nrow=5) > > > p.s. I know I'm asking a lot, but ideally, I'd like to print out > > the table with those 1-pnorm values only if they are in the right > > hand tail (i.e. >= mean) and if not nothing or NA be written. > > values[values<.5] <- NA > I'm not sure, but I think that nrows <- 5 mm <- matrix(rnorm(30),nrow=nrows) pnorm(scale(mm),lower.tail=FALSE) values[values<.5] <- NA will do the same thing. lower.tail=FALSE is a little more accurate than 1-pnorm(...) cheers Ben Bolker Brilliant! I am in awe.... Thanks for the other contributions Jab ______________________________________________ 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.