Building regression models requires an in-depth analysis of the patterns and relationship between target and input variables. The Beijing dataset provides a magnitude of different environmental factors that may affect the PM2.5 levels in the atmosphere.
In this exercise, we will visualize the pm2.5, DEWP, TEMP, and PRES variables in a time series plot and observe any patterns that may emerge over the years in these variables.
Perform the following steps to complete the exercise:
Import all the required libraries in the system:
library(dplyr) library(lubridate) library(tidyr) library(grid) library(ggplot2)
Next, transform year, month, and hour into datetime using the lubridate package function named ymd_h:
PM25$datetime <- with(PM25, ymd_h(sprintf('%04d%02d%02d%02d', year, month, day,hour)))
Plot the PM2.5, TEMP, DEWP, and PRES for all the years using...