[R] warnings messages from R when returning nothing
markleeds at verizon.net
markleeds at verizon.net
Sat Jun 3 20:44:13 CEST 2006
Hi : I have old Splus code that I am trying to turn into R
( I am using windows Xp and R 2.20 ) and I am getting a warning
from one of my statements because the behavior of R is different from Splus.
below, tempdata is a matrix of numbers and
I have the following command which basically runs through the columns and returns the minimum index of the column
where an NA occurs.
badindices<-sapply(tempdata,function(x)min(bdind<-seq(along=x)[is.na(x)])))
The problems seems to be that, if the column doesn't have any NAs,
then I get the following warning : "no finite arguments to min :
returning inf". So, consequently, I get a lot of warnings
anfd -infs.
I dont have Splus right now but from the code I have under
the above command it looks like Splus returned NA rather than -inf and didn't give any warnings. This would be the the way
I would prefer it to be handled. So, I was
hoping that there is there a way to avoid getting these
warning and get the behavior that Splus gave me by modifying
the code or setting something in the environment ?
Thanks a lot.
Mark
More information about the R-help
mailing list