Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Challenge: Vector Labeler | R Conditional Statements Tutorial
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Control Flow in R

bookChallenge: Vector Labeler

Aufgabe

Swipe to start coding

You are given a vector of temperatures in Celsius. Your task is to categorize each temperature as 'Cold', 'Warm', or 'Hot' using vectorized conditional logic with the ifelse function, without using any explicit loops.

  • Use the provided temps vector.
  • Assign 'Cold' to temperatures below 15.
  • Assign 'Warm' to temperatures from 15 up to and including 30.
  • Assign 'Hot' to temperatures above 30.
  • Store the result in a character vector called weather.

Lösung

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 1. Kapitel 6
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: Vector Labeler

Swipe um das Menü anzuzeigen

Aufgabe

Swipe to start coding

You are given a vector of temperatures in Celsius. Your task is to categorize each temperature as 'Cold', 'Warm', or 'Hot' using vectorized conditional logic with the ifelse function, without using any explicit loops.

  • Use the provided temps vector.
  • Assign 'Cold' to temperatures below 15.
  • Assign 'Warm' to temperatures from 15 up to and including 30.
  • Assign 'Hot' to temperatures above 30.
  • Store the result in a character vector called weather.

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 1. Kapitel 6
single

single

some-alt