Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: Mutate Customer Data | Data Manipulation with dplyr
Data Manipulation in R (Core)

bookChallenge: Mutate Customer Data

Opgave

Swipe to start coding

Practice using mutate() to add new columns for customer segmentation. Your goal is to create an age column and a segment column in the given data frame.

  • Add a new column age to the data frame, calculated as 2024 - birth_year.
  • Add a new column segment to the data frame, assigning "youth" if age is less than 25, "adult" if age is 25 or older but less than 65, and "senior" if age is 65 or older.

Løsning

Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 1. Kapitel 4
single

single

Spørg AI

expand

Spørg AI

ChatGPT

Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat

close

bookChallenge: Mutate Customer Data

Stryg for at vise menuen

Opgave

Swipe to start coding

Practice using mutate() to add new columns for customer segmentation. Your goal is to create an age column and a segment column in the given data frame.

  • Add a new column age to the data frame, calculated as 2024 - birth_year.
  • Add a new column segment to the data frame, assigning "youth" if age is less than 25, "adult" if age is 25 or older but less than 65, and "senior" if age is 65 or older.

Løsning

Switch to desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 1. Kapitel 4
single

single

some-alt