MulaiMulai sekarang secara gratis

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.

Latihan ini adalah bagian dari kursus

Introduction to Writing Functions in R

Lihat Kursus

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Write a function to convert lb to kg
lbs_to_kgs <- ___
Edit dan Jalankan Kode