Question
ANSWER IN R CODING LANGUAGE ONLY a) Write a function called is_factor() that takes as input x, an object. is_factor(x) outputs TRUE if the input
ANSWER IN R CODING LANGUAGE ONLY
a)
Write a function called is_factor() that takes as input x, an object. is_factor(x) outputs TRUE if the input object x is a factor and FALSE otherwise. This function should work for both ordered and unordered factor vectors.
b)
Write a function called is_list_of_factors() that takes as input x, an object. If x is a list where each sub-element is a factor, then is_list_of_factors(x) outputs TRUE, otherwise it outputs FALSE. You may use is_factor() in your solution. You can assume x will never be empty, but cannot assume x is a list.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started