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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!