Basic data types

Introduction to R for Finance

Lore Dirick

Manager of Data Science Curriculum at Flatiron School

Numeric

42.5
42.5
5
5
5L
5
Introduction to R for Finance

Character

"Hello world"
"Hello world"
"forty"
"forty"
"5"
"5"
Introduction to R for Finance

Logical

TRUE
TRUE
FALSE
FALSE
true
Error: object 'true' not found
NA
NA
Introduction to R for Finance

Variables and data types

my_answer <- TRUE

my_answer
TRUE
food <- "carrots"

food
"carrots"
Introduction to R for Finance

class()

my_answer <- TRUE

class(my_answer)
"logical"
class(5)
"numeric"
class(5L)
"integer"
Introduction to R for Finance

Let's practice!

Introduction to R for Finance

Preparing Video For Download...