Re: [R] Base function for flipping matrices

2012-01-02 Thread Hadley Wickham
But if not,  it seems to me that it should be added as an array method to ?rev with an argument specifying which indices to rev() over. Yes, agreed. Sometimes arrays seem like something bolted onto R that is missing a lot of functionality. Hadley -- Assistant Professor / Dobelman Family

Re: [R] Base function for flipping matrices

2012-01-02 Thread Richard M. Heiberger
Hadley, Your request is reminding me of the analysis of aray functions in Philip S Abrams dissertation http://www.slac.stanford.edu/cgi-wrap/getdoc/slac-r-114.pdf AN APL MACHINE The section that starts on page 17 with this paragraph is the one that immediately applies C. The Standard Form for

Re: [R] Base function for flipping matrices

2012-01-02 Thread Claudia Beleites
Hadley, I started to throw some functions that I needed to be extended to arrays together as package arrayhelpers. If you consider that a good home for the new functions, they would be more than welcome. Currently I have the package at r-forge, but I wouldn't mind github, either (so far I just

Re: [R] Base function for flipping matrices

2012-01-02 Thread Hadley Wickham
Your request is reminding me of the analysis of aray functions in Philip S Abrams dissertation http://www.slac.stanford.edu/cgi-wrap/getdoc/slac-r-114.pdf AN APL MACHINE The section that starts on page 17 with this paragraph is the one that immediately applies C. The Standard Form for

[R] Base function for flipping matrices

2011-12-31 Thread Hadley Wickham
Hi all, Are there base functions that do the equivalent of this? fliptb - function(x) x[nrow(x):1, ] fliplr - function(x) x[, nrow(x):1] Obviously not hard to implement (although it needs some more checks), just wondering if it had already been implemented. Hadley -- Assistant Professor /

Re: [R] Base function for flipping matrices

2011-12-31 Thread Hans W Borchers
Hadley Wickham hadley at rice.edu writes: See functions flipud(), fliplr() in package 'matlab' (or 'pracma'). Those are the names of corresponding functions in MATLAB. Hans Werner Hi all, Are there base functions that do the equivalent of this? fliptb - function(x) x[nrow(x):1, ]

Re: [R] Base function for flipping matrices

2011-12-31 Thread Bert Gunter
Hadley: Dunno. But if not, it seems to me that it should be added as an array method to ?rev with an argument specifying which indices to rev() over. Cheers, Bert On Sat, Dec 31, 2011 at 7:08 AM, Hadley Wickham had...@rice.edu wrote: Hi all, Are there base functions that do the equivalent

Re: [R] Base function for flipping matrices

2011-12-31 Thread William Revelle
Hadley, Presumably for fliplr you meant ncol(x) fliplr - function(x) x[, ncol(x):1] Bill On Dec 31, 2011, at 9:08 AM, Hadley Wickham wrote: Hi all, Are there base functions that do the equivalent of this? fliptb - function(x) x[nrow(x):1, ] fliplr - function(x) x[, nrow(x):1]