LoslegenKostenlos loslegen

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.

  1. One pound (lb) is 0.45359237 kilograms (kg).
  2. One bushel is 48 lbs of barley, 56 lbs of corn, or 60 lbs of wheat.

magrittr is loaded.

Diese Übung ist Teil des Kurses

Introduction to Writing Functions in R

Kurs anzeigen

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Write a function to convert lb to kg
lbs_to_kgs <- ___
Code bearbeiten und ausführen