Henrik Bengtsson
2011-Feb-15 18:11 UTC
[Rd] matrixStats: Extend to arrays too (Was: Re: Suggestion: Adding quick rowMin and rowMax functions to base package)
Hi. On Sun, Feb 13, 2011 at 10:18 AM, TakeoKatsuki <takeo.katsuki at gmail.com> wrote:> > Hi Henrik, > > It would be nice if functions of the matrixStats package can handle array > data. > For example, rowSums() of the base package sums along the third axis of an > array by rowSums(x, dim=2).That is a good idea. This was indeed the initial objective before starting matrixStats. After debating (mostly with myself) on what a consistent and solid API for arrays would look like I decided to postpone that and just focus on matrices (the more immediate need). A well-designed API generalized to work with arrays should probably borrow ideas from how argument 'MARGIN' of apply() works, how argument 'dim' in rowSums() for (though I must say the letter seem a bit ad hoc at first sight given the name of the function). There may also be something to learn from the 'reshape' package and so. Having said this, code contributions toward an array-based API are appreciated. As a start it may be better to make the extension independent of the existing matrix-based API, at least before a solid array-based API has been settled. /Henrik> Thanks. > > Takeo[snip]
Hadley Wickham
2011-Feb-15 18:52 UTC
[Rd] matrixStats: Extend to arrays too (Was: Re: Suggestion: Adding quick rowMin and rowMax functions to base package)
> A well-designed API generalized to work with arrays should probably > borrow ideas from how argument 'MARGIN' of apply() works, how argument > 'dim' in rowSums() for (though I must say the letter seem a bit ad hoc > at first sight given the name of the function). ?There may also be > something to learn from the 'reshape' package and so.I'd also recommend looking at plyr::aaply, which fixes a few things that have always annoyed me about apply - namely that it is not idempotent/identical to aperm when the summary function is the identity. Hadley -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/
Maybe Matching Threads
- Suggestion: Adding quick rowMin and rowMax functions to base package
- matrixStats 0.13.1 - Methods that Apply to Rows and Columns of a Matrix (and Vectors)
- matrixStats 0.13.1 - Methods that Apply to Rows and Columns of a Matrix (and Vectors)
- Take the maximum of every 12 columns
- Which license is applied to "debian rules" in the Libogg?