Choosing types for shipment records

Mark Yourself Question

  1. Grab a piece of paper and try this problem yourself.
  2. When you're done, check the "I have answered this question" box below.
  3. View the solution and report whether you got it right or wrong.

A dispatch analyst receives the following values for three shipments. The text "not supplied" explicitly means that the package count is unknown. Priority has the business ranking routine, then urgent, then critical.


Attribute

Values in shipment order

Shipment identifier

"0038", "0147", "0652"

Package count

"9", "not supplied", "12"

Priority

"urgent", "routine", "critical"

Delivery confirmed

TRUE, FALSE, NA


Recommend an R representation for each attribute and justify your choices. Write base R expressions that create the representations from these values and verify missingness in the package counts. Explain why numeric factor codes would not measure priority differences and why an unknown delivery status should remain distinct from FALSE. Do not construct a data frame.

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More R Data Types Questions: