Challenge: Avoid Factor Pitfalls
Task
Swipe to start coding
Convert a factor of survey ratings to numeric values and ensure the levels are ordered from lowest to highest satisfaction.
- Create a new factor from
ratings_factorwith levels ordered as "Poor", "Fair", "Good", "Excellent". - Convert the ordered factor to numeric values, where "Poor" is 1 and "Excellent" is 4.
- Return the resulting numeric vector.
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 1. ChapterΒ 18
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 5.56
Challenge: Avoid Factor Pitfalls
Swipe to show menu
Task
Swipe to start coding
Convert a factor of survey ratings to numeric values and ensure the levels are ordered from lowest to highest satisfaction.
- Create a new factor from
ratings_factorwith levels ordered as "Poor", "Fair", "Good", "Excellent". - Convert the ordered factor to numeric values, where "Poor" is 1 and "Excellent" is 4.
- Return the resulting numeric vector.
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 1. ChapterΒ 18
single