[R] some strange result

Ahmad Abu Hammour hammour at msn.com
Sat Dec 7 06:19:03 CET 2002


Hi,
I use R 1.6.1 on my machine. While I working I got some strange result. Here
is a piece of a longer code:

minb=0.7; stpb=0.1
minw=0.7; maxw=1.0; stpw=0.1
nj=((1-minb)/stpb)+1
ni=((maxw-minw)/stpw)+1
solm=array(0,c(ni,5,nj))

Everything is OK but if you set minb, minw or both = 0.8 or 0.9

you will get the following error message:

"Error in array(0, c(ni, 5, nj)) : dim<- length of dims do not match the
length of object"

One more thing. Try to do the following to get another strange result.
as.integer((1-0.8)/0.1) which gives you 1 instead of 2.
as.integer((1-0.9)/0.1) which gives you 0 instead of 1.
as.integer((1-0.7)/0.1) which gives you 3 which is correct.

This could be a bug or just meant to be like that. I appreciate your help.

Ahmad Abu Hammour




More information about the R-help mailing list