use software R to answer this
2.19 You track your commute times for two weeks (ten days), recording the following times in minutes: 17 16 20 24 22 15 21 15 17 22 Enter these into R. Use the function max to find the longest commute time, the function mean to find the average, and the function min to find the minimum. Oops, the 24 was a mistake. It should have been 18. How can you fix this? Do so, and then find the new average. How many times was your commute 20 minutes or more? What percent of your commutes are less than 18 minutes long? 2.21 The following data records the average salary in major league baseball for the years 1990-1999 (in millions): 0.57 0. 89 1. 08 1. 12 1. 18 1. 07 1. 17 1. 38 1.44 1. 72 Use diff to find the differences from year to year. Are there any years where the amount dropped from the previous year? The percentage difference is the difference divided by the previous year times 100. This can be found by dividing the output of diff by the first nine numbers (but not all ten). After doing this, determine which year has the biggest percentage increase. 2.22 Write a function to compute the average distance from the mean for some data vector. 2.23 Write a function f which finds the average of the x values after squaring and subtracts the square of the average of the numbers. Verify this output will always be non-negative by computing f( 1:10). 2.24 An integer is even if the remainder upon dividing it by 2 is 0. This re- mainder is given by R with the syntax x %% 2. Use this to write a function i seven that indicates if a number is even. How would you write i sodd? 2.25 Write a function isprime that checks if a number x is prime by dividing x by all the values in 2, .. ., x - 1 then checking to see if there is a remainder of 0. The expression a %% b returns the remainder of a divided by b