6.4 Data types

Several data types exist in R:

  • numeric (numbers)
  • character (strings)
  • logical / boolean (TRUE / FALSE)
  • factor (categories)

For this introductory course, we will mainly see and manipulate numeric (numbers) and character (strings) data types.

A character or string of characters must be assigned with simple or double quotes (““), for example:

myobject <- "training"

You should now see in the environment (upper-right corner) the new object called training.

Now try to assign the same object without the quotes:

myobject <- training

What happens?