~/ learn/ afm-112/ cards/ R and RStudio II: Factors, Data Frames, and Reading Data
1 of 50

In R, with prov4 <- c("ON", "QC", "ON", "BC"), type the assignment that converts it to a factor named prov_f.

In R, with prov4 <- c("ON", "QC", "ON", "BC"), type the assignment that converts it to a factor named prov_f.

Answer

prov_f <- factor(prov4)

Printing prov_f gives [1] ON QC ON BC and a second line, Levels: BC ON QC — the distinct categories, alphabetical by default.

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/7a169c3b-9d3b-473f-a1ac-f3631435ff6c/flashcard utf-8 LF