fgeo.tool (version 1.2.5)

nms_try_rename: 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

Run this code
# NOT RUN {
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")
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab