maechler@stat.math.ethz.ch
2003-Jan-08 14:07 UTC
[Rd] integer coercion when indexing and subsetting (PR#2430)
At the end of his bug report, Philippe says PhGr> ..... Moreover, the subset operation [] uses as.integer() and PhGr> consequently, can suffer from the same syndrome. A WARNING section in PhGr> Extract.Rd would be welcome too. [BTW: Thank you Philippe! ] Currently, "Extract.Rd" does not say anything on the kind of indices `i' that can be used in things like x[i]. OTOH, the R language reference has a nice section>> Indexing by vectors >> ------------------- >> R allows some powerful constructions using vectors as indices. We >> shall discuss indexing of simple vectors first. For simplicity, assume >> that the expression is `x[i]'. Then the following possibilities exist >> according to the type of `i'. >> >> *Integer* ............... >> ........................ >> >> >> * *Other numeric*. Non-integer values are converted to integer >> before use. >> >> <<........>>I agree with Philippe that help(Extract) should say more. 1) point to the "R Language Reference" BTW: we should think on how to do this with links that work with HTML/PDF and also with ESS and Info (I read all R manuals in info most of the time). For the moment, just could use \url{....}, right? 2) Tell about `i' = names or integers or as.integer(numeric) at least, right? Martin Maechler <maechler@stat.math.ethz.ch> http://stat.ethz.ch/~maechler/ Seminar fuer Statistik, ETH-Zentrum LEO C16 Leonhardstr. 27 ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND phone: x-41-1-632-3408 fax: ...-1228 <><