6.4 Data types

There are several data types in R:

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

For this introduction, we will mainly see and use 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?