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
class(my_string)                 # Testing class of character string
# "character"

Example: Converting Character String to name Object

my_name <- as.name(my_string)    # Conversion
class(my_name)                   # Testing class
# "name"
is.name(my_name)                 # Return logical whether object is name
# TRUE

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed

Menu
Top