[Rd] Undocumented bahavior of as.integer() (PR#2430)

Philippe Grosjean phgrosjean@sciviews.org
Wed Jan 8 16:08:00 2003


OK, no need to emphasize too much... sorry for my ignorance on the R help
sections. To answer Duncan Murdoch, I do not have _real_ example because the
example was provided by someone else in R-help. By the way, the example was
mispelled in my previous mail and is (under R 1.6.1 and Win 2000):

> ind <- 10 * (73.1 + (10 * seq(14)) - 76)
> ind
 [1]   71  171  271  371  471  571  671  771  871  971 1071 1171 1271 1371
> as.integer(ind)
 [1]   70  170  270  370  470  571  671  771  871  971 1071 1171 1271 1371
># thus:
>mat <- seq(1420)
>submat1 <- mat[ind]        #  NOT what I expected
>submat2 <- mat[round(ind)] #  much better

I suppose that such a complicated construction of "ind" had some meanings in
the initial application.
Again, I do not complain for a bug. There is no bug. I just suggest to
mention this behavior in help files...
Best,

Philippe Grosjean

...........]<(({?<...............<?}))><...............................
 ) ) ) ) )
( ( ( ( (       Dr. Philippe Grosjean
 ) ) ) ) )
( ( ( ( (       LOV, UMR 7093
 ) ) ) ) )      Station Zoologique
( ( ( ( (       Observatoire Oceanologique
 ) ) ) ) )      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)
 ) ) ) ) )
.......................................................................