Grain yields and unit conversion

Introduction to Writing Functions in R

Richie Cotton

Data Evangelist at DataCamp

USDA NASS

The USDA NASS logo, including the slogan 'Agriculture counts'.

Introduction to Writing Functions in R

Corn and wheat

Some corn cobs, in a field.

Some wheat, in a field.

  • Soon these will be food
  • Hmm, delicious
Introduction to Writing Functions in R

1 acre = area of land 2 oxen can plough in a day

A farmer and two yoked oxen ploughing a field in Cambodia.

Introduction to Writing Functions in R

Not the 100 Acre Wood

The trees and moorland of Ashdown Forest.jpg

Introduction to Writing Functions in R

1 hectare = 2 football fields

Two US football stadia

Introduction to Writing Functions in R

1 hectare = 150 New York apartments

The outside of some buildings in Manhattan's East Village. The apartments are tiny.

Introduction to Writing Functions in R

1 bushel = 2 baskets of peaches

Two bushels of peaches.

Introduction to Writing Functions in R

1 kilogram = 1 squirrel monkey

A squirrel monkey on a branch

Introduction to Writing Functions in R

magrittr's pipeable operator replacements

operator functional alternative
x * y x %>% multiply_by(y)
x ^ y x %>% raise_to_power(y)
x[y] x %>% extract(y)
Introduction to Writing Functions in R

Let's practice!

Introduction to Writing Functions in R

Preparing Video For Download...