~/ learn/ afm-112/ cards/ Blank, NA, −999, and why they must be declared
1 of 8

In R, type the call that averages `amount` while dropping any missing values.

In R, type the call that averages `amount` while dropping any missing values.

Answer

mean(orders$amount, na.rm = TRUE)

With one NA, mean() alone returns NA; na.rm = TRUE removes the missing values first and returns 438.1818 for the eleven known orders.

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/2270a971-773d-43fd-9d95-c1c72fdac053/flashcard utf-8 LF