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
Step: 1
Get Instant Access with AI-Powered 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