[Rd] scientific notation and comparison with character variable
Joshua Ulrich
josh.m.ulrich at gmail.com
Wed Jan 2 19:43:45 CET 2013
It's expected. From ?"<":
If the two arguments are atomic vectors of different types, one is
coerced to the type of the other, the (decreasing) order of
precedence being character, complex, numeric, integer, logical and
raw.
> as.character(1e-2) < 0.05
[1] TRUE
> as.character(1e-4) < 0.05
[1] FALSE
Best,
--
Joshua Ulrich | about.me/joshuaulrich
FOSS Trading | www.fosstrading.com
On Wed, Jan 2, 2013 at 12:38 PM, Tobias Verbeke
<tobias.verbeke at openanalytics.eu> wrote:
> L.S.
>
> Is the following expected and/or documented?
>
>> 1e-2 < "0.05"
> [1] TRUE
>> 1e-4 < "0.05"
> [1] FALSE
>
> Many thanks in advance for any pointer.
>
> Best,
> Tobias
>
>> sessionInfo()
> R Under development (unstable) (2013-01-01 r61512)
> Platform: i386-w64-mingw32/i386 (32-bit)
>
> locale:
> [1] LC_COLLATE=English_United States.1252
> [2] LC_CTYPE=English_United States.1252
> [3] LC_MONETARY=English_United States.1252
> [4] LC_NUMERIC=C
> [5] LC_TIME=English_United States.1252
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
More information about the R-devel
mailing list