nms_try_rename: Try to rename an object.

View source: R/nms_manipulate_names.R

nms_try_renameR Documentation

Try to rename an object.

Description

Given a name you want and a possible alternative, this function renames an object as you want or errs with an informative message.

Usage

nms_try_rename(x, want, try)

Arguments

x

A named object.

want

String of length 1 giving the name you want the object to have.

try

String of length 1 giving the name the object might have.

See Also

nms

Other functions for developers: check_crucial_names(), extract_insensitive(), flag_if_group(), is_multiple(), rename_matches(), type_ensure()

Examples

nms_try_rename(c(a = 1), "A", "a")
nms_try_rename(data.frame(a = 1), "A", "a")

# Passes
nms_try_rename(c(a = 1, 1), "A", "a")
## Not run: 
# Errs
# nms_try_rename(1, "A", "A")

## End(Not run)


fgeo.tool documentation built on May 29, 2024, 5:30 a.m.