[R] Sorting a list
Peter Dalgaard
P.Dalgaard at biostat.ku.dk
Mon Jul 7 14:44:10 CEST 2008
tolga.i.uzuner at jpmorgan.com wrote:
> Dear R Users,
>
> A bit of a simple question, but I could not find the answer thru google
> ("sorting lists r cran","how can i sort a list r cran") or RSiteSearch...
> how can I sort a list ?
>
> One imagines something like sort.list would do the job, but that's not the
> one.
>
>
>> foo<-list(a=10,b=2,c=3)
>> sort.list(foo)
>>
> Error in sort.list(foo) : 'x' must be atomic for 'sort.list'
> Have you called 'sort' on a list?
>
> Is there existing functionality which can sort a list ?
>
> Thanks in advance,
> Tolga
>
Sort it by what?
I.e. what should it do with list(a=3, b=c(2,4))?
--
O__ ---- Peter Dalgaard Øster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list