[R] complexity of operations in R

Jan van der Laan rhelp at eoos.dds.nl
Thu Jul 19 19:55:18 CEST 2012


On 07/19/2012 05:50 PM, Hadley Wickham wrote:
> On Thu, Jul 19, 2012 at 8:02 AM, Jan van der Laan <rhelp at eoos.dds.nl> wrote:
>> The following function is faster than your g and easier to read:
>>
>> g2 <- function(dotot) {
>>    v <- list()
>>    for (i in seq_len(dotot)) {
>>      v[[i]] <- FALSE
>>    }
>> }
> Except that you don't need to pre-allocate lists...
I don't think I understand what you mean by that. Could you elaborate?

Jan



More information about the R-help mailing list