[Rd] Undocumented bahavior of as.integer() (PR#2430)
phgrosjean@sciviews.org
phgrosjean@sciviews.org
Wed Jan 8 11:25:03 2003
as.integer() truncates doubles toward zero, as Splus does (at least v. 6.1
under Windows does). Thus:
> look <- (10 * seq(14)) - 76
> 10 * (73.1 + look)
[1] 71 171 271 371 491 586 681 791 886 981 1101 1201 1301 1401
> as.integer(10 * (73.1 + look))
[1] 70 170 270 370 490 586 681 791 886 981 1101 1201 1301 1401
... It is not documented in R! I propose appending the following to
as.integer.Rd:
\section{ WARNING }{ During coercion of doubles, real numbers are not
rounded but truncated (the closest integer towards zero is returned).
Attributes are deleted.}
And I suggest adding the previous exemple in the corresponding section in
as.integer.Rd. Moreover, the subset operation [] uses as.integer() and
consequently, can suffer from the same syndrome. A WARNING section in
Extract.Rd would be welcome too.
Version:
platform = i386-pc-mingw32
arch = i386
os = mingw32
system = i386, mingw32
status =
major = 1
minor = 6.1
year = 2002
month = 11
day = 01
language = R
Windows XP Professional (build 2600) Service Pack 0.0
Search Path:
.GlobalEnv, package:ctest, Autoloads, package:base
...........]<(({°<...............<°}))><...............................
) ) ) ) )
( ( ( ( ( Dr. Philippe Grosjean
) ) ) ) )
( ( ( ( ( LOV, UMR 7093
) ) ) ) ) Station Zoologique
( ( ( ( ( Observatoire Océanologique
) ) ) ) ) BP 28
( ( ( ( ( 06234 Villefranche sur mer cedex
) ) ) ) ) France
( ( ( ( (
) ) ) ) ) tel: +33.4.93.76.38.16, fax: +33.4.93.76.38.34
( ( ( ( (
) ) ) ) ) e-mail: phgrosjean@sciviews.org
( ( ( ( ( SciViews project coordinator (http://www.sciviews.org)
) ) ) ) )
.......................................................................