list_rename {listr}R Documentation

Rename elements of a named list.

Description

Rename elements of a named list.

Usage

list_rename(in_list, ...)

Arguments

in_list

The list to rename elements in.

...

The renaming definitions.

Details

'list_rename()' changes the name of elements in a named list. The definitions for renaming are given in '...' in the style 'new_name = old_name'. You can specify as many renaming definitions as you like as long as there are not more definitions than elements in the list.

If no renaming definition is given the input list is returned. If you try to rename elements not present in the list nothing happens; unless you provide more renaming definitions than elements in the list, in that case an error is raised.

Value

The list provided in 'in_list' with elements renamed according to the definition in '...'.

Examples

my_list <- list(a = 1, b = 2, c = 3)
list_rename(my_list, AAA = "a", CCC = "c")

[Package listr version 0.1.0 Index]