I am a novice of R. This variable, test.ind, has 2 levels. It's an indicator for whether the customer participated in the program; "R"=participated, "C"=nonparticipant (control).
The question is: Convert the variable test.ind to a 0/1 indicator variable (an integer), and name it treat, where customers enrolled in the program are assigned a value of 1, and customers not enrolled in the program are assigned a value of 0.
How should I do that?
> dput(head(newdata, 5)[c("test.ind")]) structure(list(test.ind = structure(c(2L, 2L, 2L, 2L, 2L), .Label = c("C", "R"), class = "factor")), row.names = c(NA, 5L), class = "data.frame")