I just found out that R assumes that vectors created with the : operator are integer:
a<-1:3 is.integer(a)
[1] TRUE Vectors created with seq() can be integer
a<-seq(1,3) is.integer(a)
[1] TRUE or double
a<-seq(1,3,1) is.integer(a)
[1] FALSE The vector is double if I do it like this:
a<-c(1,2,3) is.integer(a)
[1] FALSE rep() seems to make doubles:
a<-rep(1,3) is.integer(a)
[1] FALSE A single number with no decimal place is double:
is.integer(1)
[1] FALSE This is the reason I previously thought all numbers were double in R. Maybe there's a good reason for this situation, but it seems strange and inconsistent to me. This might be a silly suggestion, but how about: * all numbers assumed to be double unless explicitly set as integer * * using integer() or changed to integer using as.integer() * Bill -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._