The as.name() function in R converts a given R object into a name class object.
The name class object has the class
"name".class(name_object)returns the name of the class from which the R object is inherited.
as.name(value)
The as.name() function takes the parameter value, value, which represents the R object.
The as.name() function returns a name class object.
# creating an R objectnumber <- 123# printing the value stored in numbernumber# calling the as.name() functionname_object = as.name(number)# printing the name class objectname_object# checking if its a name class objectis.name(name_object)# checking the classclass(name_object)
number.number.as.name() function on the number variable. The result is assigned to a variable name_object.name_object.is.name() function and check if the variable, name_object is a name class object.class() function we returned the class of the object name_object.