Chapter 2 Data variables (objects) in R

As with all other computer languages information needs to be stored in a way that can be recalled, displayed and analysed. A variable name is used to point to a data object in memory (or on disk).

The conventions for a variable name:

  • should not start with a number,
  • should not contain spaces,
  • should not be the same as function names as this can be ambiguous,
  • should not contain special characters such as #, %, &. These characters require special handling and often lead to errors that require debugging.