Hi r-help-boun...@r-project.org napsal dne 19.06.2011 20:45:04:
> > Hi: > > It's just an extra step: > > y <- list(list(c(1,5),c(2,3,4)), list(c(1, 3, 4), c(5, 7))) > lapply(seq_len(length(y)), function(i) lapply(y[[i]], min)) > [[1]] > [[1]][[1]] > [1] 1 > > [[1]][[2]] > [1] 2 > > [[2]] > [[2]][[1]] > [1] 1 > > [[2]][[2]] > [1] 5 > > unlist(lapply(seq_len(length(y)), function(i) lapply(y[[i]], min))) > [1] 1 2 1 5 Or you can use rapply rapply(y, min) [1] 1 2 1 5 Regards Petr > > HTH, > Dennis > > On Sun, Jun 19, 2011 at 8:25 AM, jiliguala <jiligu...@mail.com> wrote: > > > > but in my case, the list is a two-variable list, list[[j]][[i]] > > > > when i use > > > > lapply(list, min) > > > > it appears > > """Error in FUN(X[[1L]], ...) : invalid 'type' (list) of argument""" > > > > thanks > > > > -- > > View this message in context: http://r.789695.n4.nabble.com/how-to-get- > the-miminum-value-in-the-list-tp3609013p3609433.html > > Sent from the R help mailing list archive at Nabble.com. > > > > ______________________________________________ > > R-help@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. > > > > ______________________________________________ > R-help@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. ______________________________________________ R-help@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.