[R] c() coverts real numbers to integers?

Dieter Menne dieter.menne at menne-biomed.de
Sat Mar 7 10:05:30 CET 2009


John Poulsen <jpoulsen <at> ufl.edu> writes:
> I know I am forgetting to do something silly.  I typed coordinates in 
> vectors (as below) but when I call them in R they come out as integers, 
> and I want them to be real numbers.  I have tried using as.numeric, 
> as.real, etc... but they are still read by R as integers.
> 
> STX<-c(16.0962, 16.1227, 16.0921, 16.1498)
> STY<-c(2.0387, 2.0214, 1.9877, 1.9846)

Your should tell us what "come out" means. If str(STX) gives integer,
then I am lost and you probably have a pre-0.01 version of R.

If you see

STX
[1] 16 16 16 16

then somewhere in your code you have set

options(digits=1).

Dieter




More information about the R-help mailing list