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

bookChallenge: Vector Labeler

Uppgift

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ösning

Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 1. Kapitel 6
single

single

Fråga AI

expand

Fråga AI

ChatGPT

Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal

Suggested prompts:

Can you explain this in simpler terms?

What are some examples related to this topic?

Where can I learn more about this?

close

bookChallenge: Vector Labeler

Svep för att visa menyn

Uppgift

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ösning

Switch to desktopByt till skrivbordet för praktisk övningFortsätt där du är med ett av alternativen nedan
Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 1. Kapitel 6
single

single

some-alt