Re: [R] sapply(pred,cor,y=resp)

2011-10-09 Thread Joshua Wiley
Hi, It is probably more confusing with several steps combined, but you are correct that it is because there are NAs. It is fairly common for R functions to return NA if there are any NA values unless you explicitly set an argument on what to do with missing values. A quick look at ?cor clearly s

[R] sapply(pred,cor,y=resp)

2011-10-09 Thread William Claster
Hello. I am wondering why I am getting NA for all in cors=sapply(pred,cor,y=resp). I suppose that each column in pred has NAs in them. Is there some way to fix this? Thanks > str(pred) 'data.frame':   200 obs. of  13 variables:  $ mnO2: num  9.8 8 11.4 4.8 9 13.1 10.3 10.6 3.4 9.9 ...  $ Cl  :