What is a list?

Introduction to R for Finance

Lore Dirick

Manager of Data Science Curriculum at Flatiron School

Lists

cash
  company cash_flow year
1       A      1000    1
2       A      4000    3
3       A       550    4
4       B      1500    1
5       B      1100    2
6       B       750    4
7       B      6000    5
company_name <- "DataCampers Inc"
Introduction to R for Finance

Lists

my_company <- list(company_name, cash)

my_company
[[1]]
"DataCampers Inc."
[[2]]
  company cash_flow year
1       A      1000    1
2       A      4000    3
3       A       550    4
4       B      1500    1
5       B      1100    2
6       B       750    4
7       B      6000    5
Introduction to R for Finance

Subsetting lists

my_company[1]
[[1]]
"DataCampers Inc."
my_company[[1]]
"DataCampers Inc."
my_company[[2]]
  company cash_flow year
1       A      1000    1
2       A      4000    3
3       A       550    4
4       B      1500    1
5       B      1100    2
6       B       750    4
7       B      6000    5
Introduction to R for Finance

Let's practice!

Introduction to R for Finance

Preparing Video For Download...