Re: [R] Using column length in plot gives error

2009-05-16 Thread Stephanie Kovalchik
Is spectra.wavelength a factor? If so, plot will treat it as categorical and not draw a line. Try the following modification. plot(as.numeric(spectra.wavelength), cormat, type = "l", ylim=c(-1,1), xlab="Wavelength (nm)", ylab="Correlation") Quoting MikSmith : Hi I'm trying to write a ge

Re: [R] a general way to select a subset of matrix rows?

2009-05-10 Thread Stephanie Kovalchik
One simple adjustment is the following: apply(matrix(x[rows,],nr=length(rows)),2,mean) Quoting Peter Kharchenko : Dear fellow R users, I can't figure out how to do a simple thing properly: apply an operation to matrix columns on a selected subset of rows. Things go wrong when only one row is

Re: [R] need help with chisq

2009-05-10 Thread Stephanie Kovalchik
JC, If each row are the counts for a 2 x 2 contingency table - so for the ith contingency table you have counts for row 1 c(Y08[i],Z08[i]) and row 2 (Y09[i],Z09[i]) then you could use apply: X <- cbind(vdata$Y08,vdata$X08-vdata$Y08,vdata$Y09,vdata$X09-vdata$Y98) f.chisq <- function(x){ m <