[R] Vector docs

Duncan Murdoch murdoch.duncan at gmail.com
Sun May 30 13:41:28 CEST 2010


info at whywouldwe.com wrote:
> Hi
>
> The docs for R are very practical, which is quite refreshing compared to 
> other languages, however I can't find any details about all the things I 
> can do with a vector. I'm expecting methods like vector.contains('foo') 
> and vector.remove('foo'), maybe those methods don't exist but I'd love 
> to find a page that details the ones that do.
>
> I'd also like to find some docs about foreach loops (unless there's a 
> better way to iterate through a vector), I've only found mailing list posts.
>
>   

There may be such a page somewhere, but it is probably incomplete.  The 
object model in R has methods owned by generics, not by classes.  So 
even if someone wrote a list of all methods that worked on vectors, 
someone else could add a new one without modifying the vector class.

You can ask R what methods are currently visible, e.g.

library(methods)
showMethods(classes="vector")

but it won't show methods in unattached packages.

Duncan Murdoch



More information about the R-help mailing list