Skip to content

scientific notation and comparison with character variable

3 messages · Joshua Ulrich, Tobias Verbeke

#
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
#
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.
[1] TRUE
[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:
#
Thanks and apologies for the noise.

Best wishes,
Tobias
On 01/02/2013 07:43 PM, Joshua Ulrich wrote: