Re: [R] as.numeric rounds up

From: Henrique Dallazuanna <wwwhsd_at_gmail.com>
Date: Fri, 1 Feb 2008 16:27:00 -0200

options(digits=10)

> b

or just

print(b, 10)

On 01/02/2008, Monica Pisica <pisicandru_at_hotmail.com> wrote:
>
>
> Hi list,
>
> It seems that as.numeric is rounding up my numbers that are in a character format.
>
> Example:
>
> a
> [1] "776554.45" "776985.31" "776076.03" "776092.01" "776151.42" "776276.97"
>
>
> b <- as.numeric(a)
> b
> [1] 776554.4 776985.3 776076.0 776092.0 776151.4 776277.0
>
>
>
> I've tried as.numeric(a,2) and as.numeric(a, digits = 2) but it didn't work, nor ? as.numeric gave me any clues. How can i transform my character numbers in numeric without loosing the decimal digits?
>
> Thanks,
>
> Monica
>
>
> _________________________________________________________________
> [[elided Hotmail spam]]
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Fri 01 Feb 2008 - 18:30:11 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 01 Feb 2008 - 19:30:10 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive