setOrderList: Reorder List Elements by Name

View source: R/setOrderList.R

setOrderListR Documentation

Reorder List Elements by Name

Description

Moves specified elements to the front and/or back of a list while preserving the relative order of all other elements.

Usage

setOrderList(l, first = NULL, last = NULL)

Arguments

l

A named list.

first

A character vector of names to move to the front.

last

A character vector of names to move to the back.

Value

A list with reordered elements. Names that do not exist in l are silently ignored.

Examples

my_list <- list(c = 3, a = 1, d = 4, b = 2)
setOrderList(my_list, first = c("a", "b"), last = "c")

NMdata documentation built on June 17, 2026, 9:06 a.m.