Question: Open a new script in R Studio. Write the code to complete the below listed tasks. Add comments to your code to answer any questions/requests
Open a new script in R Studio. Write the code to complete the below listed tasks. Add comments to your code to answer any questions/requests posed within the tasks. Copy your code (including comments) into the answer window. Create 4 vectors named ID, Name, Hair and Size with the values below (pay attention to the letter case of the vector names) (4 pts) : ID: values from 1 to 5 (1 pt) Name: "Joe", "John", "Jack", "Jed", "Jerry" (1 pt) Hair: "Blonde", "Brown", "Brown", "Black", "Red" (1 pt) Size: 1, 2, 3, 1, 2 (1 pt) Convert the Size vector to an ordered factor by doing the following (4 pts) : a. Convert Size to a factor named Size_factor. (1 pt) b. Set ordered to TRUE. (1 pt) c. Label the levels as "Small" for 1, "Medium" for 2 and "Large" for 3. (2 pt) Create a date frame named Info using the vectors ID, Name, Hair and Size_factor. Print Info to check it. (3 pts ) Check the structure of Info using an appropriate function. What is(are) the name(s) of the numeric variable(s)? (3 pt) Print the second and fifth rows of Info. (2 pts)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
