A supplier export contains the literal text "NA", a genuine missing character value, and an empty string. An analyst recreates these entries in R:
region <- c("NA", NA_character_, "") is.na(region)
What logical vector does the final expression return?
FALSE, TRUE, FALSE
FALSE, TRUE, TRUE
FALSE, FALSE, FALSE
TRUE, TRUE, FALSE
Unlock full course notes by signing up
Category labels and underlying storage
An analyst represents subscription tiers in two ways using the following base R code. Complete the diagnostic table for both objects. Enter type and class names without quotation marks, and logical results as TRUE or FALSE.
Each column gives the function to apply to the object named in that row.
A conversion round trip that loses amounts
A billing analyst tests whether converting monetary adjustments to integers and then back to doubles preserves the original dollar amounts. The following code runs in base R:
The function identical(x, y) returns TRUE when the objects match exactly in values, types, and attributes; otherwise, it returns FALSE.
Complete the audit statements. Enter the first two answers as exact integers, the type name without quotation marks, and the final two answers as TRUE or FALSE.
Recovering amounts from factor labels
A legacy system represents three service fees, in dollars, as a factor:
Which statement correctly describes the numeric result and gives an expression that recovers all three fee amounts in their original order?
Choosing types for shipment records
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.
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.