Open In App
Related Articles

Assigning values to variables in R programming – assign() Function

Improve Article
Improve
Save Article
Save
Like Article
Like

In R programming, assign() method is used to assign the value to a variable in an environment.

Syntax : assign(variable, value)
Return : Return the variable having value assigned.

Example 1:




# Using assign() method
assign("gfg", 10)
  
print(gfg)


Output:

[1] 10

Example 2:




# Using assign() method
assign("gfg", 20.12345)
  
print(gfg)


Output:

[1] 20.12345
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!

Last Updated : 10 May, 2020
Like Article
Save Article
Previous
Next
Similar Reads