Skip to content

cghr-toronto/covid-data

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CGHR's COVID-19 data

Introduction

This repository has Coronavirus (Covid-19) data related to CGHR's COVID-19 initiative. All data posted here are free for the public to use.

There several sources of COVID-19 data on the web. Here we list some sources we have identified so far.

Data sources on the web:

In our COVID-19 forecasting paper we mostly used data from Coronavirus App.

How to use this repository

The data found in this repository can be downloaded by clicking on the file name above and then right clicking on the "Raw" menu button and choosing "Save Link As". Alternatively, you can clone this repository in your computer by using Git.

Additionally, CGHR and non-CGHR researchers can access the data above and other data sets through our COVID-19 database (db). Our db was created using PostgreSQL, an open-source db software. You can connect to it using most statistics programs (R, Stata, Excel, etc.).

Please contact us to request a login or a SQL dump file.

Note: The data are updated twice a week.

  • See datasets.csv for an overview of current data sets shared in this repository

How to use the data with R

R is an open-source statistical and computational program. You can download it here R-project.

  • Sample code to grab data from CGHR's public COVID-19 db

      #Install libraries
      install.packages("DBI")
      		
      # Load library
      library(DBI)
      
      # create connection to db
      con <- DBI::dbConnect(drv = RPostgres::Postgres(), user='?', password='?', host='IP', port='?', dbname='covid_19')
    
      # get table from db
      res <- dbSendQuery(con, "SELECT * FROM jh_ts_covid19_deaths_global")
      cv19 <- dbFetch(res)
      
      # See data table dimensions
      dim(cv19)
    
      # See first and last 6 rows
      head(cv19)
      tail(cv19)
      
      # write table as CSV file
      write.table(cv19, "/path/cv19.txt", sep=",", row.names=FALSE)
    
      # remove res object
      dbClearResult(res)
    
      # disconnect from db
      dbDisconnect(con)
    

Terms of use

The content presented here is free for the public to use.

Contact: cghr@smh.ca, CGHR.org