rlang (version 0.2.1)

sym: Create a symbol or list of symbols

Description

These functions take strings as input and turn them into symbols. Contrarily to as.name(), they convert the strings to the native encoding beforehand. This is necessary because symbols remove silently the encoding mark of strings (see set_str_encoding()).

Usage

sym(x)

syms(x)

Arguments

x

A string or list of strings.

Value

A symbol for sym() and a list of symbols for syms().

Examples

Run this code
# NOT RUN {
# The empty string returns the missing argument:
sym("")

# This way sym() and as_string() are inverse of each other:
as_string(missing_arg())
sym(as_string(missing_arg()))
# }

Run the code above in your browser using DataCamp Workspace