Try this:

tapply(a, row(a), f, simplify = FALSE)

tapply(a, row(a), max, simplify = FALSE) # still returns list


On 11/21/05, Robin Hankin <[EMAIL PROTECTED]> wrote:
> Hi Dimitris
>
>
> On 21 Nov 2005, at 08:37, Dimitris Rizopoulos wrote:
> > out <- lapply(apply(a2, 1, f), "[[", 1)
>
>
> thanks for this, but it doesn't quite do what I want:
>
>
>  > f <- function(x){1:max(x[1],4)}
>  > lapply(apply(cbind(1:5,5:1), 1, f), "[[", 1)
> [[1]]
> [1] 1
>
> [[2]]
> [1] 1
>
> [[3]]
> [1] 1
>
> [[4]]
> [1] 1
>
> [[5]]
> [1] 1
>
>  >
>
> I want
>
> > [[1]]
> > [1] 1 2 3 4
> >
> > [[2]]
> > [1] 1 2 3 4
> >
> > [[3]]
> > [1] 1 2 3 4
> >
> > [[4]]
> > [1] 1 2 3 4
> >
> > [[5]]
> > [1] 1 2 3 4 5
>
>
>
> best wishes
>
> Robin
>
>
>
>
> --
> Robin Hankin
> Uncertainty Analyst
> National Oceanography Centre, Southampton
> European Way, Southampton SO14 3ZH, UK
>  tel  023-8059-7743
>
> ______________________________________________
> [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
>

______________________________________________
[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

Reply via email to