get()
function in R Language is used to return an object with the name specified as argument to the function. This is another method of printing values of the objects just like print function. This function can also be used to copy one object to another.
Syntax: get(object)
Parameters:
object: Vector, array, list, etc.
Example 1:
x1 < - c( "abc" , "cde" , "def" )
x2 < - c( 1 , 2 , 3 )
x3 < - c( "M" , "F" )
get( "x2" )
x4 < - get( "x3" )
print (x4)
|
Output:
[1] 1 2 3
[1] "M" "F"
Example 2:
x1 < - c( "abc" , "cde" , "def" )
x2 < - c( 1 , 2 , 3 )
list1 < - list (x1, x2)
get( "list1" )
|
Output:
[[1]]
[1] "abc" "cde" "def"
[[2]]
[1] 1 2 3
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!