Re: [Rd] faster base::sequence

2010-12-16 Thread Hervé Pagès
Hi Romain, FWIW I see at least 2 small differences in the way sequence_c() behaves with respect to good old sequence(): zeros and names. sequence(c(a=5, b=0, c=2)) a1 a2 a3 a4 a5 c1 c2 1 2 3 4 5 1 2 sequence_c() ignores the names and doesn't support zeros in the input. Cheers, H. On

[Rd] faster base::sequence

2010-11-28 Thread Romain Francois
Hello, Based on yesterday's R-help thread (help: program efficiency), and following Bill's suggestions, it appeared that sequence: sequence function (nvec) unlist(lapply(nvec, seq_len)) environment: namespace:base could benefit from being written in C to avoid unnecessary memory

Re: [Rd] faster base::sequence

2010-11-28 Thread Prof Brian Ripley
Is sequence used enough to warrant this? As the help page says Note that ‘sequence - function(nvec) unlist(lapply(nvec, seq_len))’ and it mainly exists in reverence to the very early history of R. I regard it as unsafe to assume that NA_INTEGER will always be negative, and bear

Re: [Rd] faster base::sequence

2010-11-28 Thread Romain Francois
Le 28/11/10 10:30, Prof Brian Ripley a écrit : Is sequence used enough to warrant this? As the help page says Note that ‘sequence - function(nvec) unlist(lapply(nvec, seq_len))’ and it mainly exists in reverence to the very early history of R. I don't know. Would it be used more if it were

Re: [Rd] faster base::sequence

2010-11-28 Thread Prof Brian Ripley
On Sun, 28 Nov 2010, Romain Francois wrote: Le 28/11/10 10:30, Prof Brian Ripley a écrit : Is sequence used enough to warrant this? As the help page says Note that ‘sequence - function(nvec) unlist(lapply(nvec, seq_len))’ and it mainly exists in reverence to the very early history of R. I

Re: [Rd] faster base::sequence

2010-11-28 Thread Romain Francois
Le 28/11/10 11:30, Prof Brian Ripley a écrit : On Sun, 28 Nov 2010, Romain Francois wrote: Le 28/11/10 10:30, Prof Brian Ripley a écrit : Is sequence used enough to warrant this? As the help page says Note that ‘sequence - function(nvec) unlist(lapply(nvec, seq_len))’ and it mainly exists in