[R] Any container in R?

Feng Qiu hustqiufeng at sohu.com
Wed Jan 3 07:13:24 CET 2007


Hi Thomas:
           Thanks for your explanation.
           You are right that in C++, we try to use the same piece of codes 
on different type of objects. While in R, most operations are done in a 
"vector" way automatically, which reduced the need for containers.

Best,
Feng
----- Original Message ----- 
From: "Thomas Lumley" <tlumley at u.washington.edu>
To: "Feng Qiu" <hustqiufeng at sohu.com>
Cc: "Duncan Murdoch" <murdoch at stats.uwo.ca>; <r-help at stat.math.ethz.ch>
Sent: Monday, January 01, 2007 3:21 PM
Subject: Re: [R] Any container in R?


> 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 at u.washington.edu University of Washington, Seattle
>
>
>
>



More information about the R-help mailing list