How to Apply the as.name() & is.name() Functions in R (Example Code)
In this R tutorial you’ll learn how to use the as.name and is.name functions.
Creation of Example Data
my_string <- "whatever" # Exemplifying character string |
my_string <- "whatever" # Exemplifying character string
class(my_string) # Testing class of character string # "character" |
class(my_string) # Testing class of character string # "character"
Example: Converting Character String to name Object
my_name <- as.name(my_string) # Conversion |
my_name <- as.name(my_string) # Conversion
class(my_name) # Testing class # "name" |
class(my_name) # Testing class # "name"
is.name(my_name) # Return logical whether object is name # TRUE |
is.name(my_name) # Return logical whether object is name # TRUE