R stores data in named objects.
Create an object by assigning data to a name. For clarity, it's conventional to assign with <-, but other operators exist:
- Left assign: <- or =
- Right assign: ->
Names are unique. If you assign to a new name, R creates a new object. If you assign to an existing name, the old object and its content disappear, replaced by your new assignment. Overwriting any object in R is that easy, so keep an eye on RStudio's auto-suggest box to see if a function or another object already has the name you plan to use.
Retrieve the content of an object by calling the object's name.
An object name is interchangeable with its content. Try it in your code.