Challenge: Vector Labeler
Tehtävä
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
tempsvector. - 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.
Ratkaisu
Oliko kaikki selvää?
Kiitos palautteestasi!
Osio 1. Luku 6
single
Kysy tekoälyä
Kysy tekoälyä
Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme
Mahtavaa!
Completion arvosana parantunut arvoon 5.56
Challenge: Vector Labeler
Pyyhkäise näyttääksesi valikon
Tehtävä
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
tempsvector. - 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.
Ratkaisu
Oliko kaikki selvää?
Kiitos palautteestasi!
Osio 1. Luku 6
single