Basic data types in R

  R works with numerous data types. Some of the most basic types to get started are: 

Note how the quotation marks on the right indicate that "some text" is a character.

Instruction

Change the value of the:

# Change my_numeric to be 42 my_numeric <- 42.5 # Change my_character to be "universe" my_character <- "some text" # Change my_logical to be FALSE my_logical <- TRUE # Change my_numeric to be 42 my_numeric <- 42 # Change my_character to be "universe" my_character <- "universe" # Change my_logical to be FALSE my_logical <- FALSE test_object("my_numeric", incorrect_msg = "Have you correctly changed the declaration of `my_numeric` so it contains the value 42?") test_object("my_character", incorrect_msg = "Have you correctly changed `my_character` to `\"universe\"`? Don't forget the quotes!") test_object("my_logical", incorrect_msg = "Have you correctly changed `my_logical` to `FALSE`? All letters of `FALSE` should be capitalized!") success_msg("Great work! Continue to the next exercise.")

Replace the values in the editor with the values that are provided in the exercise. For example: my_numeric <- 42 assigns the value 42 to the variable my_numeric.

Previous: 1-6 | Apples and oranges

Next: 1-8 | What's that data type?

Back to Main