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

bookChallenge: Vector Labeler

Oppgave

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

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 1. Kapittel 6
single

single

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

close

bookChallenge: Vector Labeler

Sveip for å vise menyen

Oppgave

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 desktopBytt til skrivebordet for virkelighetspraksisFortsett der du er med et av alternativene nedenfor
Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 1. Kapittel 6
single

single

some-alt