On 11/21/05, Robin Hankin <[EMAIL PROTECTED]> wrote:
> Hi Gabor
>
> thanks for this.
>
>
> On 21 Nov 2005, at 13:26, Gabor Grothendieck wrote:
> > Try this:
> >
> > tapply(a, row(a), f, simplify = FALSE)
> >
>
> [
> here
> a <- cbind(1:5 , 5:1)
> f <- function(x){list(1:max(x[1],4))}
> ]
>
>
> This also works. I actually need unlist(... , recursive=FALSE)
> to pass the list to do.call() but that 's fine.
>
> But, my question here is: how does one arrive at
> such a solution from the manpage? The manpage seems
> to indicate that the first argument to tapply() is a ragged
> array, or a vector.
>
> I can't reconcile Gabor's use of tapply() with the manpage.
>
> How to understand Gabor's suggestion better?
A matrix is just a vector with a dim attribute.
> x <- 1:4
> attr(x, "dim") <- c(2,2) # or dim(x) <- c(2,2)
> class(x)
[1] "matrix"
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html