Re: [R] 1-pnorm values in a table

2008-03-06 Thread Jabez Wilson
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(value

Re: [R] 1-pnorm values in a table

2008-03-06 Thread Ben Bolker
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) > >

Re: [R] 1-pnorm values in a table

2008-03-06 Thread John Kane
This is a bit ugly but I think it works. myf <- function(x) 1-pnorm(x,mean(x), sd(x)) results <- apply(test, 2, myf) mymeans <- apply(test, 2, mean); mymeans for (i in 1:length(test)){ test[,i][test[,1]>=mymeans[i]] <- NA } results[is.na(tes

Re: [R] 1-pnorm values in a table

2008-03-06 Thread Richard . Cotton
> I've read in a csv file (test.csv) which gives me the following table: > >Hin1 Hin2 Hin3Hin4 Hin5 Hin6 > HAI1 9534.83 4001.74 157.16 3736.93 484.60 59.25 > HAI2 13272.48 1519.88 36.35 33.64 46.68 82.11 > HAI3 12587.71 5686.94 656.62 572.29 351.60 136.91 > H