C. Using print() instead of cat() to display output.
D. Missing comma between 'high' and 'low' in ifelse arguments.
Solution
Step 1: Check the ifelse argument syntax
The ifelse function requires three arguments separated by commas: condition, yes, no.
Step 2: Identify missing comma
In the code, "high" and "low" are not separated by a comma, causing a syntax error.
Final Answer:
Missing comma between 'high' and 'low' in ifelse arguments. -> Option D
Quick Check:
Arguments must be comma-separated [OK]
Hint: Check commas between all ifelse arguments [OK]
Common Mistakes:
Omitting commas between arguments
Confusing operators > and >=
Thinking print() causes error here
5. You have a numeric vector temps <- c(-5, 0, 10, 20, 30). Use ifelse to create a new vector labels that labels temperatures below 0 as "freezing", between 0 and 20 (inclusive) as "cold", and above 20 as "warm". Which code correctly does this?