Session Ready
Exercise

Recode a numeric variable

Dummy variables are often used in data analysis to bin a variable into one of two categories to indicate the absence or presence of something. Dummy variables take the value 0 or 1 to stand for, for example, loser or winner. Dummy variables are often factor variables as opposed to numeric - we'll cover more about factors in the last chapter.

In desserts, the technical variable is a number representing the judges' ranks for each baker in the technical challenge, for every episode (remember to run glimpse(desserts) to take a peek). In this exercise, you will recode the numeric technical variable to a new factor dummy variable.

Instructions 1/3
undefined XP
  • 1
  • 2
  • 3
  • Create a new dummy variable called tech_win: it should be equal to 1 if the baker was ranked first in the technical challenge, and 0 if not. Remember that when recoding numeric variables, you need to put the old value in backticks, for example, `5` = 6.