Learn R Programming

fuj (version 0.2.1)

names: Set names

Description

Sets or removes names

Usage

set_names(x, nm = x)

remove_names(x)

x %names% nm

is_named(x, zero_ok = TRUE)

Value

x with nm values assigned to names (if x is NULL, NULL is returned)

Arguments

x

A vector of values

nm

A vector of names

zero_ok

If TRUE allows use of "" as a special name

Examples

Run this code
set_names(1:5)
set_names(1:5, c("a", "b", "c", "d", "e"))

x <- c(a = 1, b = 2)
remove_names(x)
x %names% c("c", "d")
is_named(x)

Run the code above in your browser using DataLab