Dear all, it looks like that tabulate() does not check for the bounds of the input. Reproducible example: > b <- 1:2> tabulate(b[1:100])[1] 1 1> R.version_ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status Patched major 2 minor 11.1 year 2010 month 09 day 30 svn rev 53072 language R version.string R version 2.11.1 Patched (2010-09-30 r53072)> sessionInfo()R version 2.11.1 Patched (2010-09-30 r53072) Platform: i386-pc-mingw32 (32-bit) locale: [1] LC_COLLATE=Italian_Italy.1252 LC_CTYPE=Italian_Italy.1252 LC_MONETARY=Italian_Italy.1252 [4] LC_NUMERIC=C LC_TIME=Italian_Italy.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] gtools_2.6.2 loaded via a namespace (and not attached): [1] tools_2.11.1 OS: Windows 7 64 bit -- ______________________________________________________ Simone Giannerini Dipartimento di Scienze Statistiche "Paolo Fortunati" Universita' di Bologna Via delle belle arti 41 - 40126? Bologna,? ITALY Tel: +39 051 2098262? Fax: +39 051 232153 http://www2.stat.unibo.it/giannerini/
Dear Simone, On 04.10.2010, at 01:01, Simone Giannerini wrote:> it looks like that tabulate() does not check for the bounds of the input. > Reproducible example: > >> b <- 1:2 >> tabulate(b[1:100]) > [1] 1 1this looks perfectly reasonable. Consider the result of> b <- 1:2 > b[1:100][1] 1 2 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA and check the help page for tabulate (esp. the na.rm argument). What was your expected result? Cheers, Olaf
Apparently Analagous Threads
- parRapply and parCapply return a list in corner cases
- NROW and NCOL on NULL
- Under Windows, Rgui and Rterm crash if one tries to close the graphic device while identify or locator are running
- Under Windows, Rgui and Rterm crash if one tries to close the graphic device while identify or locator are running
- Under Windows, Rgui and Rterm crash if one tries to close the graphic device while identify or locator are running