Covid-19 Tracker
Covid-19 is a severe and contagious respiratory illness caused by a new Coronavirus,
SARS-Cov-2.
Symptoms include:
- fever or chills
- cough
- shortness of breath or difficulty breathing
- fatigue
- headache
- new loss of taste or smell
- sore throat
- congestion or runny nose
- nausea or vomiting
- diarrhea
Cases are rising and the CDC recommends maintaining social distance, wearing facial covering, and staying home if you suspect that you may have Covid-19. For information on symptoms, vaccine and testing centers, and guidance on dealing with Covid, click here.
data <- read.csv('https://covid.ourworldindata.org/data/owid-covid-data.csv')
yesterday <- Sys.Date() - 1
data_cleaned <- data %>% select(iso_code, continent, location, total_cases, total_deaths, new_deaths, date) %>% filter(date== yesterday & location != "World")
library(plotly)
data_cleaned$hover <- with(data_cleaned, paste(location, '<br>', "Total Cases: ", total_cases, '<br>', "Total Deaths: ", total_deaths, '<br>', "Date: ", date))
# light grey boundaries l <- list(color = toRGB("grey"), width = 0.5)
# specify map projection/options g <- list( showframe = FALSE, showcoastlines = FALSE, projection = list(type = 'Mercator') )
fig <- plot_geo(data_cleaned) %>% add_trace( z = ~total_deaths, color = ~total_deaths, text = ~hover, colors = 'RdBu', text = ~location, locations = ~iso_code, marker = list(line = l)) %>% colorbar(title = 'Total Deaths') %>% layout( title = 'Covid Data by Country<br> (Hover for breakdown)<br> Source: <a>href="https://covid.ourworldindata.org/data/owid-covid-data.csv">Our World in Data<a>', dragmode= FALSE, geo = g )
fig
#htmlwidgets::saveWidget(fig, "fig_plot_geo.html")
library(streamgraph)
sg_data <- data %>% filter(grepl("^(Asia|Africa|Oceania|North America|South America|Europe)$", continent)) %>% group_by(date, continent)
daily_cases_smoothed_by_continent <- sg_data %>% tally(wt= new_cases_smoothed) %>% streamgraph("continent", "n", "date", interpolate = "cardinal") %>% sg_fill_brewer(palette = "Blues") %>% sg_legend(show = TRUE, label = "Continent:") daily_cases_smoothed_by_continent
#htmlwidgets::saveWidget(daily_cases_smoothed_by_continent, "daily_cases_smoothed_by_continent.html")
state_covid_data <- read.csv('https://raw.githubusercontent.com/nytimes/covid-19-data/master/us-states.csv') %>% filter(date== yesterday)
state_codes <- read.csv("https://raw.githubusercontent.com/plotly/datasets/master/2011_us_ag_exports.csv") %>% select(state, code)
state_covid_data <- merge(state_codes, state_covid_data)
library(plotly)
state_covid_data$hover <- with(state_covid_data, paste(state, '<br>', 'Total Cases: ', cases, '<br>', 'Total Deaths: ', deaths, '<br>', 'Date: ', date))
# give state boundaries a white border l <- list(color = toRGB('grey'), width = 0.5)
# specify some map projection/options g <- list( scope = 'usa', projection = list(type = 'albers usa') )
fig1 <- plot_geo(state_covid_data, locationmode = 'USA-states')
fig <- fig %>% add_trace( z = ~deaths, text = ~hover, locations = ~code, color = ~deaths, colors = 'RdBu', marker = list(line = l) )
fig1 <- fig %>% colorbar(title = 'Total Deaths')
fig1 <- fig %>% layout( title = "Covid Data by State<br> (Hover for breakdown)<br> Source:<a>href='https://raw.githubusercontent.com/nytimes/covid-19-data/master/us-states.csv'>New York Times<a>", dragmode= FALSE, geo = g )
fig1
#htmlwidgets::saveWidget(fig1, "fig_plot_geo1.html")
References
Hasell, J., Mathieu, E., Beltekian, D. et al. A cross-country database of COVID-19 testing. Sci Data 7, 345 (2020).
The New York Times. Coronavirus (Covid-19) Data in the United States (2021).