as_string()
converts symbols to character strings.
Arguments
- x
A string or symbol. If a string, the attributes are
removed, if any.
Value
A character vector of length 1.
See also
as_name()
for a higher-level variant of as_string()
that automatically unwraps quosures.
Examples
# Let's create some symbols:
foo <- quote(foo)
bar <- sym("bar")
# as_string() converts symbols to strings:
foo
#> foo
as_string(foo)
#> [1] "foo"
typeof(bar)
#> [1] "symbol"
typeof(as_string(bar))
#> [1] "character"