COVID-19: How to get data from COVID-19 Data Hub, python, r ver. 2

Last Updated on December 27, 2021 by shibatau

I. COVID-19 Data Hub

The goal of COVID-19 Data Hub is to provide the research community with a unified dataset by collecting worldwide fine-grained case data, merged with exogenous variables helpful for a better understanding of COVID-19. COVID-19 Data Hub

II. How to get data

1.Python

You can learn how to load the data here:

https://covid19datahub.io/articles/python.html

I’ve loaded the data and created a simple line chart for infected counts in Japan according to my Cheat Sheets. You can see the scripts here:

https://colab.research.google.com/drive/1K40RyptFFbeCSr3T7zmQPWGob-6U9Ic7?usp=sharing

2.R

Here is the scripts:

library(COVID19)
library(tidyverse)
x <- covid19()
# convert it to a tibble
x <- covid19(level = 2)
head(x)
all_level2 <- as_tibble(x)
str(all_level2)
all_level2 |>
  select(date, confirmed, administrative_area_level_2) |> 
  filter(administrative_area_level_2 == "Tokyo") -> tokyo
tokyo
library(ggplot2)
# create a basic line chart
ggplot(data = tokyo, aes(x = date, y = confirmed, group=1)) +
  geom_line()

 

About shibatau

I was born and grown up in Kyoto. I studied western philosophy at the University and specialized in analytic philosophy, especially Ludwig Wittgenstein at the postgraduate school. I'm interested in new technology, especially machine learning and have been learning R language for two years and began to learn Python last summer. Listening toParamore, Sia, Amazarashi and MIyuki Nakajima. Favorite movies I've recently seen: "FREEHELD". Favorite actors and actresses: Anthony Hopkins, Denzel Washington, Ellen Page, Meryl Streep, Mia Wasikowska and Robert DeNiro. Favorite books: Fyodor Mikhailovich Dostoyevsky, "The Karamazov Brothers", Shinran, "Lamentations of Divergences". Favorite phrase: Salvation by Faith. Twitter: @shibatau

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.