Skip to content
Related Articles

Related Articles

Improve Article

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

  • Last Updated : 10 May, 2020
Geek Week

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
My Personal Notes arrow_drop_up
Recommended Articles
Page :