Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Challenge: Pipe Your Data Manipulation | Pipes and Chaining Operations
Data Manipulation in R (Core)

bookChallenge: Pipe Your Data Manipulation

In analytics, you often need to perform several data manipulation steps in sequence—such as selecting columns, filtering rows, creating new variables, and arranging results. Rather than writing separate commands, you can use the pipe operator '%>%' to chain these operations together, making your code cleaner and easier to follow. This approach is especially useful when cleaning and preparing data for analysis, as it allows you to express a series of transformations as a single, readable pipeline. Now, you will practice chaining multiple dplyr verbs using pipes to achieve a real-world data cleaning task.

Aufgabe

Swipe to start coding

You are given an orders data frame containing order information. Your goal is to clean this data using a single pipeline with pipes and dplyr verbs.

  • Select only the columns order_id, customer, amount, and status.
  • Filter for orders where status is "Completed" and amount is greater than 100.
  • Create a new column amount_usd by multiplying amount by 1.1.
  • Arrange the resulting data in descending order of amount_usd.

Assign your final data frame to cleaned_orders.

Lösung

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 2. Kapitel 2
single

single

Fragen Sie AI

expand

Fragen Sie AI

ChatGPT

Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen

close

bookChallenge: Pipe Your Data Manipulation

Swipe um das Menü anzuzeigen

In analytics, you often need to perform several data manipulation steps in sequence—such as selecting columns, filtering rows, creating new variables, and arranging results. Rather than writing separate commands, you can use the pipe operator '%>%' to chain these operations together, making your code cleaner and easier to follow. This approach is especially useful when cleaning and preparing data for analysis, as it allows you to express a series of transformations as a single, readable pipeline. Now, you will practice chaining multiple dplyr verbs using pipes to achieve a real-world data cleaning task.

Aufgabe

Swipe to start coding

You are given an orders data frame containing order information. Your goal is to clean this data using a single pipeline with pipes and dplyr verbs.

  • Select only the columns order_id, customer, amount, and status.
  • Filter for orders where status is "Completed" and amount is greater than 100.
  • Create a new column amount_usd by multiplying amount by 1.1.
  • Arrange the resulting data in descending order of amount_usd.

Assign your final data frame to cleaned_orders.

Lösung

Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 2. Kapitel 2
single

single

some-alt