Question: Using function data() to load R data set airquality . Provide the simplest R code and output for all of the following. The code should

Using function data() to load R data set airquality.

Provide the simplest R code and output for all of the following. The code should work for any given data.

a)Use the diff function to calculate the temperature differences between consecutive days.

Insert the value 0 at the beginning of these differences. Add this result as the DIFFS column of the data frame.

b)Calculate the number of days that are warmer than the previous day?

c)Show the mean and median temperature for each month (May to Sept.). Do not hard code the month. Print out your result properly. For example, "The average and median temperature for May are xxx and xxx; ...".

d) Show the coldest and hottest day in each month (May to Sept.). Do not hard code the month. Print out your result properly. For example, "The coldest and hottest days in May are xxx and xxx; ...".

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!