Converting yields to metric
The yields in the NASS corn data are also given in US units, namely bushels per acre. You'll need to write some more utility functions to convert this unit to the metric unit of kg per hectare. This time it'll be a harmonic method to account for bigger differences in numbers.
Bushels historically meant a volume of 8 gallons, but in the context of grain, they are now defined as masses. This mass differs for each grain! To solve this exercise, you need to know these facts.
- One pound (lb) is 0.45359237 kilograms (kg).
- One bushel is 48 lbs of barley, 56 lbs of corn, or 60 lbs of wheat.
magrittr
is loaded.
This exercise is part of the course
Introduction to Writing Functions in R
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Write a function to convert lb to kg
lbs_to_kgs <- ___