Dataframe-manipulatie

Introductie tot R voor Financiën

Lore Dirick

Manager of Data Science Curriculum at Flatiron School

Subsets van dataframes

debt[3:6,]
  name payment
3  Dan     150
4  Rob      50
5  Rob      75
6  Rob     100
debt[1:3, 2]
100 200 150
debt[1:3, 2, drop = FALSE]
  payment
1     100
2     200
3     150
debt$payment
100 200 150  50  75 100
Introductie tot R voor Financiën

Meer power met subset()

# Dit werkt, maar is niet informatief of robuust
debt[1:3,]

# Veel informatiever! subset(debt, name == "Dan")
  name payment
1  Dan     100
2  Dan     200
3  Dan     150
subset(debt, payment == 100)
  name payment
1  Dan     100
6  Rob     100
Introductie tot R voor Financiën

Laten we oefenen!

Introductie tot R voor Financiën

Preparing Video For Download...