Learn R Programming

rlist (version 0.4.6.2)

list.names: Get or set the names of a list by expression

Description

Get or set the names of a list by expression

Usage

list.names(.data, expr)

Arguments

.data

A list or vector

expr

the expression whose value will be set as the name for each list element. If missing then the names of the list will be returned. If NULL then the names of the list will be removed.

Examples

Run this code
# NOT RUN {
list.names(c(1,2,3))
list.names(c(a=1,b=2,c=3))
list.names(c(1,2,3),letters[.])
list.names(list(list(name='A',value=10),list(name='B',value=20)), name)
# }

Run the code above in your browser using DataLab