[R] max number from a list of numbers

Bryan Hanson hanson at depauw.edu
Thu May 20 21:36:18 CEST 2010


I think you want unlist with recursive = TRUE, see ?unlist.  Bryan
*************
Bryan Hanson
Acting Chair
Professor of Chemistry & Biochemistry
DePauw University, Greencastle IN USA



On 5/20/10 3:29 PM, "Jonathan" <jonsleepy at gmail.com> wrote:

> Hi all,
>    I'm hoping this question has a simple answer, but I can't find it through
> searching or trying commands.
> 
> I have a list of numeric vectors called 'husk'.  I'd just like to treat the
> set of all numbers from all vectors in the list as if it were one large
> vector, because I'd like to extract information, such as what is the max
> entry from all the numbers.
> 
>> husk
> [[1]]
> [1] 2 5
> 
> [[2]]
> [1]  2 17
> 
> [[3]]
> [1] 2
> 
> [[4]]
> [1] 17
> 
>> max(husk)
> Error in max(husk) : invalid 'type' (list) of argument
> 
>> max(husk[])
> Error in max(husk[]) : invalid 'type' (list) of argument
> 
>> max(husk[[]])
> Error in husk[[]] : invalid subscript type 'symbol'
> 
>> max(husk[[1:length(husk)]])
> Error in husk[[1:length(husk)]] : recursive indexing failed at level 2
> 
>> max(husk[1:length(husk)])
> Error in max(husk[1:length(husk)]) : invalid 'type' (list) of argument
> 
> Any ideas would be appreciated!
> 
> Best,
> Jonathan
> 
> [[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