[R] strange behavior in base::as.double
Sarah Goslee
@@r@h@go@|ee @end|ng |rom gm@||@com
Wed May 1 21:29:05 CEST 2024
Hi Carl,
Not that strange: R thinks you're using scientific notation. Also not a Mac bug.
> as.double('123e')
[1] 123
> as.double('123e+0')
[1] 123
> as.double('123e+1')
[1] 1230
> as.double('123e-1')
[1] 12.3
Can you explain what you're trying to accomplish?
Sarah
On Wed, May 1, 2024 at 3:24 PM Carl Witthoft <cellocgw using gmail.com> wrote:
>
> Hello.
> I'm running R 4.4.0 on an iMac Venture 13.5.2 . There appears to be a bug
> in as.double().
>
> Create a string with a numeric digits followed by a single letter a thru f
> (as tho' it's base 16).
>
> for K in (a,b,c,d, and f ) , as.double( '123K') returns NA
> but as.double('123e') returns 123 -- or whatever the first digit is.
>
> Please let me know if there are additional tests I can try .
>
>
> thanks
> Carl Witthoft
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
--
Sarah Goslee (she/her)
http://www.numberwright.com
More information about the R-help
mailing list