Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Transforming and Recoding Variables | Data Cleaning and Wrangling Essentials
Data Cleaning and Wrangling in R
Section 1. Chapter 8
single

single

bookChallenge: Transforming and Recoding Variables

Swipe to show menu

Task

Swipe to start coding

Practice transforming and recoding variables in a simulated dataset using mutate() and case_when().

  • Use mutate() to create a new variable, score_scaled, which is the score divided by 100.
  • Create a new variable, group_label, using case_when() to recode the group variable: "A" becomes "Control", "B" becomes "Treatment", and any other value becomes "Unknown".
  • Return the resulting data frame with the new variables.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 1. Chapter 8
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

some-alt