Re: [R] Any container in R?

From: Thomas Lumley <tlumley_at_u.washington.edu>
Date: Mon 01 Jan 2007 - 20:21:51 GMT

On Mon, 1 Jan 2007, Feng Qiu wrote:

> Hi Duncan:
> Thank you very much! I checked out unique(), it does exactly what I
> want. But I'm still curious about if R provides "STL"(standard template
> library).

No.

Some things the STL does aren't needed in R, others are implemented differently, and others aren't implemented.

One particularly important example is iterators, which will often either happen invisibly due to vectorized operations or will be done with the *apply family of functions.

Your example could have been done either way. Using duplicated() is the vectorized approach; the apply approach would use tapply().

C++ is not terribly similar to R. A lot of the effort in STL is expended on allowing a piece of code to be used on different types (where appropriate). In R you have to expend effort on stopping a piece of code being used on different types (where inappropriate).

         -thomas

Thomas Lumley			Assoc. Professor, Biostatistics
tlumley@u.washington.edu	University of Washington, Seattle

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue Jan 02 07:26:55 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 03 Jan 2007 - 07:30:29 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.