[R] Functional pattern-matching in R

2008-10-29 Thread Alexy Khrabrov
I found there's a very good functional set of operations in R, such as apply family, Hadley Wickham's lovely plyr, etc. There's even a Reduce (a.k.a. fold). Now I wonder how can we do pattern-matching? E.g., now I split dimensions like this: m - dim(V)[1] # R n - dim(V)[2]

Re: [R] Functional pattern-matching in R

2008-10-29 Thread Duncan Murdoch
On 29/10/2008 4:39 PM, Alexy Khrabrov wrote: I found there's a very good functional set of operations in R, such as apply family, Hadley Wickham's lovely plyr, etc. There's even a Reduce (a.k.a. fold). Now I wonder how can we do pattern-matching? E.g., now I split dimensions like this:

Re: [R] Functional pattern-matching in R

2008-10-29 Thread Gabor Grothendieck
Using the list function defined here: http://tolstoy.newcastle.edu.au/R/help/04/06/1430.html list[m, n] - as.list(dim(iris)) mylist - as.list(1:5) list[Head, Tail] - list(mylist[[1]], mylist[-1]) On Wed, Oct 29, 2008 at 4:39 PM, Alexy Khrabrov [EMAIL PROTECTED] wrote: I found there's a very