Answered You can hire a professional tutor to get the answer.

QUESTION

-You track your commute time for two weeks (ten days) recording the following times in minutes: 171620 24 2215 21 15 17 22 (a) Enter these into R and...

1.-You track your commute time for two weeks (ten days) recording the following times in minutes:

171620 24 2215 21 15 17 22

(a) Enter these into R and assign the name commute.time

(b) Write an R function called my.f that will do the following for any vector x. Compute the maximum x

  • Compute the minimum x and assign to my.min
  • Compute the average x and assign to my.mean
  • Compute the standard deviation of x and assign to my.sd
  • Compute the cumsum of x and assign to my.cumsum
  • Since the objects that you created are of different nature and length, i.e., one is a vector and the other are scalars, you can not store these values in a vector altogether. You will need a list to store them. So do that: create a list that will store those items created. Assign the list to my.list
  • Write a statement that will allow the function to return the list, i.e. we will be able to see all the results at once when we run the function
  • (c) Test the function with your commute.time vector. 
Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question