Question: This should be done by R studio .. 1. Using the baseball data in the Lahman package, calculate median baseball salary by team: a. Using
This should be done by R studio ..
1. Using the baseball data in the Lahman package, calculate median baseball salary by team: a. Using a for loop b. Using a function from the apply family c. Using dplyr d. Write a short paragraph explaining which of the above is your preferred method, and why you prefer it (no wrong answer on part d, we're just looking for your thoughts)
2. The documentation for vapply says it is a "safer" way to run sapply. Create an empty list (hint, try using an as. function and leaving the argument blank) and sum it using both sapply and vapply. Write a short paragraph about why using sapply could produce problems.
3. Using the state-level employment data, apply, and the quantile function, produce the 10%, 20%, 30%, 40%, and 50% quantile for employment by state.
The data is here : https://github.com/wampeh1/Ecog314_Spring2017/blob/master/employmentByState.csv
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
