Re: [Rd] proposal for adapting code of function gl()

2011-04-12 Thread peter dalgaard
On Apr 11, 2011, at 23:53 , Joris Meys wrote: Based on a discussion on SO I ran some tests and found that converting to a factor is best done early in the process. Hence, I propose to rewrite the gl() function as : gl2 - function(n, k, length = n * k, labels = 1:n, ordered = FALSE){ rep(

Re: [Rd] proposal for adapting code of function gl()

2011-04-12 Thread Joris Meys
Thanks for the explanation, I wasn't fully aware of which optimization I was using. I reckon your solution is more R-sound, so no reason to keep with my bizarre workaround. It would be nice though if gl() got optimized. Thank you for the example too, I'm learning every day. Cheers Joris On Tue,

Re: [Rd] proposal for adapting code of function gl()

2011-04-12 Thread peter dalgaard
On Apr 12, 2011, at 10:33 , Joris Meys wrote: Thanks for the explanation, I wasn't fully aware of which optimization I was using. I reckon your solution is more R-sound, so no reason to keep with my bizarre workaround. It would be nice though if gl() got optimized. Thank you for the example

[Rd] proposal for adapting code of function gl()

2011-04-11 Thread Joris Meys
Based on a discussion on SO I ran some tests and found that converting to a factor is best done early in the process. Hence, I propose to rewrite the gl() function as : gl2 - function(n, k, length = n * k, labels = 1:n, ordered = FALSE){ rep( rep(