Learn R Programming

rlist (version 0.2.2)

list.order: Return the order of each member in a list by expression

Description

Return the order of each member in a list by expression

Usage

list.order(.data, ..., keep.names = FALSE)

Arguments

.data
list
...
A group of lambda expressions
keep.names
Whether to keep the names of x in the result

Examples

Run this code
x <- list(p1 = list(type="A",score=list(c1=10,c2=8)),
       p2 = list(type="B",score=list(c1=9,c2=9)),
       p3 = list(type="B",score=list(c1=9,c2=7)))
list.order(x,type,desc(score$c2))
list.order(x,min(score$c1,score$c2))
list.order(x,min(score$c1,score$c2),keep.names=TRUE)

Run the code above in your browser using DataLab