[R] lapply to return vector

Dennis Murphy djmuser at gmail.com
Sat Oct 22 13:18:47 CEST 2011


do.call(rbind, lapply(...))

HTH,
D.

On Sat, Oct 22, 2011 at 1:44 AM, Alaios <alaios at yahoo.com> wrote:
> Dear all I have wrote the following line
>
>
> return(as.vector(lapply(as.data.frame(data),min,simplify=TRUE)));
>
>
> I want the lapply to return a vector as it returns a list with elements as shown below
>
> List of 30001
> $ V1    : num -131
> $ V2    : num -131
> $ V3    : num -137
> $ V4    : num -129
> $ V5    : num -130
>
>
> as you can see I have already tried the simplify=TRUE and also the as.vector() but both did not help
>
> Why I want to use lapply is because afterwards will be easier to convert it to mclapply that can use many cores to do the work.
>
> I would like to thank you in advance for your help
>
> B.R
> Alex
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list