R uses common arithmetic operators you may have seen elsewhere:
Divided by: /
To the power of: ^
The quantity: (…)
Some of R's comparison operators differ from those in other languages:
Is equal to: ==
Is not equal to: !=
Is greater than: >
Is less than: <
Is greater than or equal to: >=
Is less than or equal to: <=
Coordinate multiple comparison statements with logical operators:
The above operators work with statements that evaluate to TRUE or FALSE in R or with the values themselves:
True: TRUE or T
False: FALSE or F
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.