4.7 Names of objects

Naming objects in R is quite flexible. However, there are a few rules and good practices to consider:

  • Object names are case sensitive: object MyObject is not the same as myobject
  • They can contains both numbers or letters but should START with a letter, e.g. 2myobject is not a valid object name.
  • You can use underscores. Other special characters should be avoided.
  • Avoid using function names as object names (we will learn about functions next).

HANDS-ON

  1. Create the object myfirstobject, that contains the value 762.
  2. Create mysecondobject, that contains the value 80.
  3. Create mythirdobject , that contains the subtraction of mysecondobject from myfirstobject.