R covid 19 data analytics projects
R covid 19 data analytics projects part 2
# install packages "reader" , "ggplot2" , "dplyr"
install.packages("readr")
install.packages("ggplot2")
install.packages("dplyr")
# Load the readr, ggplot2, and dplyr packages
library(readr)
library(ggplot2)
library(dplyr)
# Read datasets/confirmed_cases_worldwide.csv into confirmed_cases_worldwide
confirmed_cases_worldwide <-read_csv("confirmed_cases_worldwide.csv")
# See the result
confirmed_cases_worldwide
# Confirmed cases throughout the world
# Draw a line plot of cumulative cases vs. date
# Label the y-axis
ggplot(data=confirmed_cases_worldwide,aes(date,cum_cases))+
geom_line() +
ylab("Cumulative confirmed cases")
# China compared to the rest of the world
confirmed_cases_china_vs_world <- read_csv("confirmed_cases_china_vs_world.csv")
# See the result
glimpse(confirmed_cases_china_vs_world)
# Draw a line plot of cumulative cases vs. date, grouped and colored by is_china
# Define aesthetics within the line geom
plt_cum_confirmed_cases_china_vs_world <- ggplot(confirmed_cases_china_vs_world) +
geom_line(aes(date, cum_cases, color = is_china)) +
ylab("Cumulative confirmed cases")
# See the plot
plt_cum_confirmed_cases_china_vs_world
Interesting !
ReplyDeleteThanks have a nice day
Delete