[R] how to convert digits to specified decimal vectors

sagarnikam123 sagarnikam123 at gmail.com
Sat Mar 24 08:25:58 CET 2012


yes sir i used format() function like

> x<-c(3,5,6)
>y<-format(x,nsmall=6)
>y
[1] "3.000000" "5.000000" "6.000000"

but it again gives me same output
> as.double(y[1])
[1] 3

i want it in decimal style like 4.000 (i.e. without string format)


--
View this message in context: http://r.789695.n4.nabble.com/how-to-convert-digits-to-specified-decimal-vectors-tp4498588p4500920.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list