CommencerCommencer gratuitement

Data type exploration

To get started, here are some of R's most basic data types:

  • Numerics are decimal numbers like 4.5. A special type of numeric is an integer, which is a numeric without a decimal piece. Integers must be specified like 4L.
  • Logicals are the boolean values TRUE and FALSE. Capital letters are important here; true and false are not valid.
  • Characters are text values like "hello world".

Cet exercice fait partie du cours

Introduction to R for Finance

Afficher le cours

Instructions

  • Assign the numeric 150.45 to apple_stock.
  • Assign the character "AAA" to credit_rating.
  • Answer the final question with either TRUE or FALSE, we won't judge!
  • Print my_answer!

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Apple's stock price is a numeric
apple_stock <- 

# Bond credit ratings are characters
credit_rating <- 

# You like the stock market. TRUE or FALSE?
my_answer <- 

# Print my_answer
Modifier et exécuter le code