reorder.list: reorder.list

View source: R/CodeAndRoll2.R

reorder.listR Documentation

reorder.list

Description

Reorder elements of lists in your custom order of names / indices.

Usage

## S3 method for class 'list'
reorder(L, namesOrdered = gtools::mixedsort(names(L)))

Arguments

L

A list.

namesOrdered

A vector of names or indices in the desired order.

Value

A list.

See Also

mixedsort

Examples

L <- list(a = 1, b = 2, c = 3)
namesOrdered <- c("c", "a", "b")
reorder.list(L, namesOrdered)

vertesy/CodeAndRoll2 documentation built on Nov. 20, 2024, 5:23 a.m.