Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem A. These problems will test your knowledge of basic and intermediate R commands. Do not use the dplyr library to answer these questions. Consider
Problem A. These problems will test your knowledge of basic and intermediate R commands. Do not use the dplyr library to answer these questions.
Consider the following small data set about 5 students
STUDENT | STATUS | SAT |
John | In State | 650 |
Joe | In State | 710 |
Jade | Out of State | 720 |
Jim | Out of State | 690 |
Jenny | In State | 775 |
- Create the STUDENT vector in R containing the names of the five students in the order shown on the able table. Similarly, create the vectors STATUS and SAT containing the respective data for each student. For the STATUS vector, just enter In for In State and Out for Out of State.
- Create a data frame called STUDENT_INFO containing the exact data above (including the student order and order that the variables appear).
- Write an R command for displaying the last two rows of STUDENT_INFO.
- Students with SAT of at least 750 or an In-State student are eligible for a scholarship. Write a single R statement (one line of R code) using logical and relational operators that will identify which student(s) is/are eligible for a scholarship by displaying a logical vector with 5 elements each of which is either TRUE or FALSE with TRUE representing being eligible. Which student(s) is/are eligible?
- Write a function named SIZE that will return the sum of the number of rows and column of a generic data frame called x. Test this function by calling using STUDENT_INFO as the argument. (Hint: you can use the dim command within the function)
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