wizualizacja-danych/proj2/projekt2.R
2021-05-26 13:39:43 +02:00

53 lines
989 B
R

library(dplyr)
library(plotly)
cov <- read.csv("proj2/owid-covid-data.csv", header = TRUE)
cov_pl <- cov[cov$location == "Poland",]
plot_ly(
cov_pl,
x = cov_pl$date,
y = cov_pl$new_deaths,
name = "New deaths",
type = "scatter",
mode = "lines+markers"
)
plot_ly(
cov_pl,
x = cov_pl$date,
y = cov_pl$new_deaths_per_million,
name = "New deaths per million",
type = "scatter",
mode = "lines+markers"
) %>%
add_trace(
y = cov_pl$new_cases_per_million,
name = "New cases per million",
type = "scatter",
mode = "lines+markers"
)
cov_pl_vac = cov_pl[as.POSIXct(cov_pl$date) > as.POSIXct('2020-12-12'),]
plot_ly(
cov_pl_vac,
x = cov_pl_vac$date,
y = cov_pl_vac$people_vaccinated,
name = "People vaccinated",
type = "scatter",
mode = "lines",
connectgaps = TRUE
) %>%
add_trace(
y = cov_pl_vac$people_fully_vaccinated,
name = "People fully vaccinated",
type = "scatter",
mode = "lines",
connectgaps = TRUE
)