data(iris)
write.csv(iris, file = 'iris.csv')
RSQLite
#install.packages('RSQLite')
library(RSQLite)
## Warning: package 'RSQLite' was built under R version 4.0.2
library(DBI)
con <- dbConnect(drv = RSQLite::SQLite(), dbname = 'demo2.db')
#dbWriteTable(conn = con, name = 'iris', value = iris, overwrite= TRUE)
dbWriteTable(conn = con, name = 'iris', value = iris, append= TRUE)
dbListTables(conn = con)
## [1] "iris"
df <- dbReadTable(conn = con, name = 'iris')
dbDisconnect(conn = con)
head(df)
## Sepal.Length Sepal.Width Petal.Length Petal.Width Species
## 1 5.1 3.5 1.4 0.2 setosa
## 2 4.9 3.0 1.4 0.2 setosa
## 3 4.7 3.2 1.3 0.2 setosa
## 4 4.6 3.1 1.5 0.2 setosa
## 5 5.0 3.6 1.4 0.2 setosa
## 6 5.4 3.9 1.7 0.4 setosa
Execute SQL Query
DDL:
CREATE TABLE test(
ID INTEGER NOT NULL,
VAL VARCHAR(32)
);
DROP TABLE test;
DML
INSERT INTO test(ID,VAL) VALUES(1, 'qoo');
INSERT INTO test (id, val) VALUES (2,'t1'), (3, 't2');
UPDATE test SET VAL = 'OOP' WHERE id = 2;
DELETE test WHERE id = 3;
## DDL
create_statement <- "
CREATE TABLE test(
ID INTEGER NOT NULL,
VAL VARCHAR(32)
);
"
insert_statement <- "
INSERT INTO test(ID,VAL) VALUES(1, 'qoo');
"
insert_statement2 <- "
INSERT INTO test (id, val) VALUES (2,'t1'), (3, 't2');
"
update_statement <- "
UPDATE test SET VAL = 'OOP' WHERE id = 2;
"
detele_statement <- "
DELETE FROM test WHERE id = 3;
"
drop_statement <- "
DROP TABLE test;
"
con <- dbConnect(drv = RSQLite::SQLite(), dbname = 'demo2.db')
dbExecute(conn = con, statement = create_statement)
## [1] 0
dbListTables(conn = con)
## [1] "iris" "test"
df = dbReadTable(conn = con, name = 'test')
str(df)
## 'data.frame': 0 obs. of 2 variables:
## $ ID : int
## $ VAL: chr
dbExecute(conn = con, statement = insert_statement)
## [1] 1
df = dbReadTable(conn = con, name = 'test')
df
## ID VAL
## 1 1 qoo
dbExecute(conn = con, statement = insert_statement2)
## [1] 2
df = dbReadTable(conn = con, name = 'test')
df
## ID VAL
## 1 1 qoo
## 2 2 t1
## 3 3 t2
dbExecute(conn = con, statement = update_statement)
## [1] 1
df = dbReadTable(conn = con, name = 'test')
df
## ID VAL
## 1 1 qoo
## 2 2 OOP
## 3 3 t2
dbExecute(conn = con, statement = detele_statement)
## [1] 1
df = dbReadTable(conn = con, name = 'test')
df
## ID VAL
## 1 1 qoo
## 2 2 OOP
dbExecute(conn = con, statement = drop_statement)
## [1] 0
#df = dbReadTable(conn = con, name = 'test')
#df
dbListTables(conn = con)
## [1] "iris"
dbDisconnect(conn = con)
DML
SELECT * FROM iris WHERE Species = 'setosa';
library(DBI)
select_statement <- "
SELECT * FROM iris WHERE species = 'setosa';
"
select_statement2 <- "
SELECT * FROM iris WHERE species = 'setosa' AND `Sepal.Length` > 5;
"
select_statement3 <- "
SELECT * FROM iris WHERE species = 'setosa' AND `Sepal.Length` > 5 ORDER BY `Sepal.Length` DESC;
"
con <- dbConnect(drv = RSQLite::SQLite(), dbname = 'demo2.db')
df <- dbGetQuery(conn = con , select_statement3)
df
## Sepal.Length Sepal.Width Petal.Length Petal.Width Species
## 1 5.8 4.0 1.2 0.2 setosa
## 2 5.7 4.4 1.5 0.4 setosa
## 3 5.7 3.8 1.7 0.3 setosa
## 4 5.5 4.2 1.4 0.2 setosa
## 5 5.5 3.5 1.3 0.2 setosa
## 6 5.4 3.9 1.7 0.4 setosa
## 7 5.4 3.7 1.5 0.2 setosa
## 8 5.4 3.9 1.3 0.4 setosa
## 9 5.4 3.4 1.7 0.2 setosa
## 10 5.4 3.4 1.5 0.4 setosa
## 11 5.3 3.7 1.5 0.2 setosa
## 12 5.2 3.5 1.5 0.2 setosa
## 13 5.2 3.4 1.4 0.2 setosa
## 14 5.2 4.1 1.5 0.1 setosa
## 15 5.1 3.5 1.4 0.2 setosa
## 16 5.1 3.5 1.4 0.3 setosa
## 17 5.1 3.8 1.5 0.3 setosa
## 18 5.1 3.7 1.5 0.4 setosa
## 19 5.1 3.3 1.7 0.5 setosa
## 20 5.1 3.4 1.5 0.2 setosa
## 21 5.1 3.8 1.9 0.4 setosa
## 22 5.1 3.8 1.6 0.2 setosa
dbDisconnect(conn = con)
create_statement <- "
CREATE TABLE test(
ID INTEGER NOT NULL,
VAL VARCHAR(32)
);
"
create_statement2 <- "
CREATE TABLE test2(
ID INTEGER NOT NULL,
VAL VARCHAR(32)
);
"
insert_statement2 <- "
INSERT INTO test (id, val) VALUES (2,'t1'), (3, 't2');
"
update_statement2 <- "
UPDATE test set val = 'hello' || val where id = 3;
"
con <- dbConnect(drv = RSQLite::SQLite(), dbname = 'demo2.db')
# method 1
dbExecute(conn = con, create_statement)
## [1] 0
dbExecute(conn = con, insert_statement2)
## [1] 2
df <- dbReadTable(conn = con, name = 'test')
df
## ID VAL
## 1 2 t1
## 2 3 t2
dbExecute(conn = con, update_statement2)
## [1] 1
df <- dbReadTable(conn = con, name = 'test')
df
## ID VAL
## 1 2 t1
## 2 3 hellot2
# method2
select_into_statement <- "
INSERT INTO test2 SELECT id, 'hello' || val FROM test;
"
dbExecute(conn = con, create_statement2)
## [1] 0
dbExecute(conn = con, select_into_statement)
## [1] 2
df <- dbReadTable(conn = con, name = 'test2')
df
## ID VAL
## 1 2 hellot1
## 2 3 hellohellot2
dbDisconnect(conn = con)
create_statement3 <- "
CREATE TABLE test3(
ID INTEGER NOT NULL,
VAL1 VARCHAR(32),
VAL2 VARCHAR(32)
);
"
insert_statement3 <- "
INSERT INTO test3(ID,VAL1,VAL2) VALUES(1, 'a', 'b');
"
update_statement3 <- "
UPDATE test3 SET VAL1 = 'C', VAL2 = 'D' WHERE ID = 1;
"
con <- dbConnect(drv = RSQLite::SQLite(), dbname = 'demo2.db')
dbExecute(conn = con, statement = create_statement3)
## [1] 0
dbExecute(conn = con, statement = insert_statement3)
## [1] 1
dbReadTable(conn = con, name = 'test3')
## ID VAL1 VAL2
## 1 1 a b
dbExecute(conn = con, statement = update_statement3)
## [1] 1
dbReadTable(conn = con, name = 'test3')
## ID VAL1 VAL2
## 1 1 C D
alter_statement <- "
ALTER TABLE test3 ADD COLUMN VAL3 INTEGER;
"
dbExecute(conn = con, statement = alter_statement)
## [1] 0
dbReadTable(conn = con, name = 'test3')
## ID VAL1 VAL2 VAL3
## 1 1 C D NA
dbDisconnect(conn = con)
Download covid19
## 確診案例
confirmed_url <- 'https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_global.csv'
confirmed_file <- 'time_series_covid19_confirmed_global.csv'
download.file(confirmed_url, confirmed_file)
##死亡案例
deaths_url <- 'https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_deaths_global.csv'
deaths_file <- 'time_series_covid19_deaths_global.csv'
download.file(deaths_url, deaths_file)
## 康復案例
recovered_url <- 'https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_recovered_global.csv'
recovered_file <- 'time_series_covid19_recovered_global.csv'
download.file(recovered_url, recovered_file)
read covid19 data
library(tidyverse)
## Warning: package 'tidyverse' was built under R version 4.0.2
## ── Attaching packages ─────────────────────────────────────────── tidyverse 1.3.0 ──
## ✓ ggplot2 3.3.2 ✓ purrr 0.3.4
## ✓ tibble 3.0.1 ✓ dplyr 1.0.0
## ✓ tidyr 1.1.0 ✓ stringr 1.4.0
## ✓ readr 1.3.1 ✓ forcats 0.5.0
## ── Conflicts ────────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
confirmed <- read_csv('time_series_covid19_confirmed_global.csv')
## Parsed with column specification:
## cols(
## .default = col_double(),
## `Province/State` = col_character(),
## `Country/Region` = col_character()
## )
## See spec(...) for full column specifications.
deaths <- read_csv('time_series_covid19_deaths_global.csv')
## Parsed with column specification:
## cols(
## .default = col_double(),
## `Province/State` = col_character(),
## `Country/Region` = col_character()
## )
## See spec(...) for full column specifications.
recovered <- read_csv('time_series_covid19_recovered_global.csv')
## Parsed with column specification:
## cols(
## .default = col_double(),
## `Province/State` = col_character(),
## `Country/Region` = col_character()
## )
## See spec(...) for full column specifications.
dim(confirmed)
## [1] 266 200
dim(deaths)
## [1] 266 200
dim(recovered)
## [1] 253 200
confirmed$Case_Type <- 'confirmed'
deaths$Case_Type <- 'deaths'
recovered$Case_Type <- 'recovered'
m <- do.call(rbind, list(confirmed, deaths, recovered))
dim(m)
## [1] 785 201
head(m)
## # A tibble: 6 x 201
## `Province/State` `Country/Region` Lat Long `1/22/20` `1/23/20` `1/24/20`
## <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 <NA> Afghanistan 33.9 67.7 0 0 0
## 2 <NA> Albania 41.2 20.2 0 0 0
## 3 <NA> Algeria 28.0 1.66 0 0 0
## 4 <NA> Andorra 42.5 1.52 0 0 0
## 5 <NA> Angola -11.2 17.9 0 0 0
## 6 <NA> Antigua and Bar… 17.1 -61.8 0 0 0
## # … with 194 more variables: `1/25/20` <dbl>, `1/26/20` <dbl>, `1/27/20` <dbl>,
## # `1/28/20` <dbl>, `1/29/20` <dbl>, `1/30/20` <dbl>, `1/31/20` <dbl>,
## # `2/1/20` <dbl>, `2/2/20` <dbl>, `2/3/20` <dbl>, `2/4/20` <dbl>,
## # `2/5/20` <dbl>, `2/6/20` <dbl>, `2/7/20` <dbl>, `2/8/20` <dbl>,
## # `2/9/20` <dbl>, `2/10/20` <dbl>, `2/11/20` <dbl>, `2/12/20` <dbl>,
## # `2/13/20` <dbl>, `2/14/20` <dbl>, `2/15/20` <dbl>, `2/16/20` <dbl>,
## # `2/17/20` <dbl>, `2/18/20` <dbl>, `2/19/20` <dbl>, `2/20/20` <dbl>,
## # `2/21/20` <dbl>, `2/22/20` <dbl>, `2/23/20` <dbl>, `2/24/20` <dbl>,
## # `2/25/20` <dbl>, `2/26/20` <dbl>, `2/27/20` <dbl>, `2/28/20` <dbl>,
## # `2/29/20` <dbl>, `3/1/20` <dbl>, `3/2/20` <dbl>, `3/3/20` <dbl>,
## # `3/4/20` <dbl>, `3/5/20` <dbl>, `3/6/20` <dbl>, `3/7/20` <dbl>,
## # `3/8/20` <dbl>, `3/9/20` <dbl>, `3/10/20` <dbl>, `3/11/20` <dbl>,
## # `3/12/20` <dbl>, `3/13/20` <dbl>, `3/14/20` <dbl>, `3/15/20` <dbl>,
## # `3/16/20` <dbl>, `3/17/20` <dbl>, `3/18/20` <dbl>, `3/19/20` <dbl>,
## # `3/20/20` <dbl>, `3/21/20` <dbl>, `3/22/20` <dbl>, `3/23/20` <dbl>,
## # `3/24/20` <dbl>, `3/25/20` <dbl>, `3/26/20` <dbl>, `3/27/20` <dbl>,
## # `3/28/20` <dbl>, `3/29/20` <dbl>, `3/30/20` <dbl>, `3/31/20` <dbl>,
## # `4/1/20` <dbl>, `4/2/20` <dbl>, `4/3/20` <dbl>, `4/4/20` <dbl>,
## # `4/5/20` <dbl>, `4/6/20` <dbl>, `4/7/20` <dbl>, `4/8/20` <dbl>,
## # `4/9/20` <dbl>, `4/10/20` <dbl>, `4/11/20` <dbl>, `4/12/20` <dbl>,
## # `4/13/20` <dbl>, `4/14/20` <dbl>, `4/15/20` <dbl>, `4/16/20` <dbl>,
## # `4/17/20` <dbl>, `4/18/20` <dbl>, `4/19/20` <dbl>, `4/20/20` <dbl>,
## # `4/21/20` <dbl>, `4/22/20` <dbl>, `4/23/20` <dbl>, `4/24/20` <dbl>,
## # `4/25/20` <dbl>, `4/26/20` <dbl>, `4/27/20` <dbl>, `4/28/20` <dbl>,
## # `4/29/20` <dbl>, `4/30/20` <dbl>, `5/1/20` <dbl>, `5/2/20` <dbl>,
## # `5/3/20` <dbl>, …
col_names <- colnames(m)
date_col <- col_names[5: (length(col_names)-1) ]
covid19_tidy_df <- m %>%
gather(key = Date, value = Case, date_col)
## Note: Using an external vector in selections is ambiguous.
## ℹ Use `all_of(date_col)` instead of `date_col` to silence this message.
## ℹ See <https://tidyselect.r-lib.org/reference/faq-external-vector.html>.
## This message is displayed once per session.
head(covid19_tidy_df)
## # A tibble: 6 x 7
## `Province/State` `Country/Region` Lat Long Case_Type Date Case
## <chr> <chr> <dbl> <dbl> <chr> <chr> <dbl>
## 1 <NA> Afghanistan 33.9 67.7 confirmed 1/22/20 0
## 2 <NA> Albania 41.2 20.2 confirmed 1/22/20 0
## 3 <NA> Algeria 28.0 1.66 confirmed 1/22/20 0
## 4 <NA> Andorra 42.5 1.52 confirmed 1/22/20 0
## 5 <NA> Angola -11.2 17.9 confirmed 1/22/20 0
## 6 <NA> Antigua and Barbuda 17.1 -61.8 confirmed 1/22/20 0
library(DBI)
con <- dbConnect(RSQLite::SQLite(), dbname = 'demo.db')
dbWriteTable(conn = con, name ='covid19', value = covid19_tidy_df, overwrite = TRUE)
dbListTables(conn = con)
## [1] "covid19"
df <- dbReadTable(conn = con, name = 'covid19')
head(df)
## Province.State Country.Region Lat Long Case_Type Date Case
## 1 <NA> Afghanistan 33.93911 67.70995 confirmed 1/22/20 0
## 2 <NA> Albania 41.15330 20.16830 confirmed 1/22/20 0
## 3 <NA> Algeria 28.03390 1.65960 confirmed 1/22/20 0
## 4 <NA> Andorra 42.50630 1.52180 confirmed 1/22/20 0
## 5 <NA> Angola -11.20270 17.87390 confirmed 1/22/20 0
## 6 <NA> Antigua and Barbuda 17.06080 -61.79640 confirmed 1/22/20 0
select_statement <- "
SELECT `Case`, Date FROM covid19 WHERE Case_Type = 'confirmed' AND `Country/Region` = 'Taiwan*';
"
df <- dbGetQuery(conn = con, statement = select_statement)
df
## Case Date
## 1 1 1/22/20
## 2 1 1/23/20
## 3 3 1/24/20
## 4 3 1/25/20
## 5 4 1/26/20
## 6 5 1/27/20
## 7 8 1/28/20
## 8 8 1/29/20
## 9 9 1/30/20
## 10 10 1/31/20
## 11 10 2/1/20
## 12 10 2/2/20
## 13 10 2/3/20
## 14 11 2/4/20
## 15 11 2/5/20
## 16 16 2/6/20
## 17 16 2/7/20
## 18 17 2/8/20
## 19 18 2/9/20
## 20 18 2/10/20
## 21 18 2/11/20
## 22 18 2/12/20
## 23 18 2/13/20
## 24 18 2/14/20
## 25 18 2/15/20
## 26 20 2/16/20
## 27 22 2/17/20
## 28 22 2/18/20
## 29 23 2/19/20
## 30 24 2/20/20
## 31 26 2/21/20
## 32 26 2/22/20
## 33 28 2/23/20
## 34 30 2/24/20
## 35 31 2/25/20
## 36 32 2/26/20
## 37 32 2/27/20
## 38 34 2/28/20
## 39 39 2/29/20
## 40 40 3/1/20
## 41 41 3/2/20
## 42 42 3/3/20
## 43 42 3/4/20
## 44 44 3/5/20
## 45 45 3/6/20
## 46 45 3/7/20
## 47 45 3/8/20
## 48 45 3/9/20
## 49 47 3/10/20
## 50 48 3/11/20
## 51 49 3/12/20
## 52 50 3/13/20
## 53 53 3/14/20
## 54 59 3/15/20
## 55 67 3/16/20
## 56 77 3/17/20
## 57 100 3/18/20
## 58 108 3/19/20
## 59 135 3/20/20
## 60 153 3/21/20
## 61 169 3/22/20
## 62 195 3/23/20
## 63 215 3/24/20
## 64 235 3/25/20
## 65 252 3/26/20
## 66 267 3/27/20
## 67 283 3/28/20
## 68 298 3/29/20
## 69 306 3/30/20
## 70 322 3/31/20
## 71 329 4/1/20
## 72 339 4/2/20
## 73 348 4/3/20
## 74 355 4/4/20
## 75 363 4/5/20
## 76 373 4/6/20
## 77 376 4/7/20
## 78 379 4/8/20
## 79 380 4/9/20
## 80 382 4/10/20
## 81 385 4/11/20
## 82 388 4/12/20
## 83 393 4/13/20
## 84 393 4/14/20
## 85 395 4/15/20
## 86 395 4/16/20
## 87 395 4/17/20
## 88 398 4/18/20
## 89 420 4/19/20
## 90 422 4/20/20
## 91 425 4/21/20
## 92 426 4/22/20
## 93 427 4/23/20
## 94 428 4/24/20
## 95 429 4/25/20
## 96 429 4/26/20
## 97 429 4/27/20
## 98 429 4/28/20
## 99 429 4/29/20
## 100 429 4/30/20
## 101 429 5/1/20
## 102 432 5/2/20
## 103 436 5/3/20
## 104 438 5/4/20
## 105 438 5/5/20
## 106 439 5/6/20
## 107 440 5/7/20
## 108 440 5/8/20
## 109 440 5/9/20
## 110 440 5/10/20
## 111 440 5/11/20
## 112 440 5/12/20
## 113 440 5/13/20
## 114 440 5/14/20
## 115 440 5/15/20
## 116 440 5/16/20
## 117 440 5/17/20
## 118 440 5/18/20
## 119 440 5/19/20
## 120 440 5/20/20
## 121 440 5/21/20
## 122 441 5/22/20
## 123 441 5/23/20
## 124 441 5/24/20
## 125 441 5/25/20
## 126 441 5/26/20
## 127 441 5/27/20
## 128 441 5/28/20
## 129 442 5/29/20
## 130 442 5/30/20
## 131 442 5/31/20
## 132 443 6/1/20
## 133 443 6/2/20
## 134 443 6/3/20
## 135 443 6/4/20
## 136 443 6/5/20
## 137 443 6/6/20
## 138 443 6/7/20
## 139 443 6/8/20
## 140 443 6/9/20
## 141 443 6/10/20
## 142 443 6/11/20
## 143 443 6/12/20
## 144 443 6/13/20
## 145 443 6/14/20
## 146 445 6/15/20
## 147 445 6/16/20
## 148 445 6/17/20
## 149 446 6/18/20
## 150 446 6/19/20
## 151 446 6/20/20
## 152 446 6/21/20
## 153 446 6/22/20
## 154 446 6/23/20
## 155 446 6/24/20
## 156 447 6/25/20
## 157 447 6/26/20
## 158 447 6/27/20
## 159 447 6/28/20
## 160 447 6/29/20
## 161 447 6/30/20
## 162 447 7/1/20
## 163 448 7/2/20
## 164 449 7/3/20
## 165 449 7/4/20
## 166 449 7/5/20
## 167 449 7/6/20
## 168 449 7/7/20
## 169 449 7/8/20
## 170 449 7/9/20
## 171 449 7/10/20
## 172 451 7/11/20
## 173 451 7/12/20
## 174 451 7/13/20
## 175 451 7/14/20
## 176 451 7/15/20
## 177 451 7/16/20
## 178 451 7/17/20
## 179 451 7/18/20
## 180 451 7/19/20
## 181 451 7/20/20
## 182 451 7/21/20
## 183 455 7/22/20
## 184 455 7/23/20
## 185 458 7/24/20
## 186 458 7/25/20
## 187 458 7/26/20
## 188 462 7/27/20
## 189 467 7/28/20
## 190 467 7/29/20
## 191 467 7/30/20
## 192 467 7/31/20
## 193 474 8/1/20
## 194 475 8/2/20
## 195 474 8/3/20
## 196 476 8/4/20
select_statement2 <- "
SELECT COUNT(DISTINCT(`Country/Region`)) AS COUNTRY_CNT FROM covid19 ;
"
df <- dbGetQuery(conn = con, statement = select_statement2)
df
## COUNTRY_CNT
## 1 188
dbDisconnect(conn = con)
setwd('covid19_repo/')
con <- dbConnect(RSQLite::SQLite(), dbname = 'covid19.db')
df <- dbReadTable(conn = con, name ='covid19')
dbDisconnect(conn = con)
table(df$Date)
##
## 03-01-2020 03-02-2020 03-03-2020 03-04-2020 03-05-2020 03-06-2020 03-07-2020
## 125 141 151 160 173 199 225
## 03-08-2020 03-09-2020 03-10-2020 03-11-2020 03-12-2020 03-13-2020 03-14-2020
## 255 266 206 216 218 230 249
## 03-15-2020 03-16-2020 03-17-2020 03-18-2020 03-19-2020 03-20-2020 03-21-2020
## 258 272 276 284 292 299 304
RPostgres
#install.packages('RPostgres')
library(RPostgres)
## Warning: package 'RPostgres' was built under R version 4.0.2
library(DBI)
#?dbConnect
# user: username
# password: password
# host: rserver IP
# port: 5432
con <- dbConnect(user = 'test', password = 'test', dbname = 'postgres', RPostgres::Postgres())
dbListTables(conn = con)
## [1] "covid19"
#dbWriteTable(conn = con, name = 'covid19', value = covid19_tidy_df)
df <- dbReadTable(conn = con, name = 'covid19')
head(df)
## Province.State Country.Region Lat Long Case_Type Date Case
## 1 <NA> Afghanistan 33.93911 67.70995 confirmed 1/22/20 0
## 2 <NA> Albania 41.15330 20.16830 confirmed 1/22/20 0
## 3 <NA> Algeria 28.03390 1.65960 confirmed 1/22/20 0
## 4 <NA> Andorra 42.50630 1.52180 confirmed 1/22/20 0
## 5 <NA> Angola -11.20270 17.87390 confirmed 1/22/20 0
## 6 <NA> Antigua and Barbuda 17.06080 -61.79640 confirmed 1/22/20 0
df <- dbGetQuery(conn = con, 'SELECT * FROM covid19 LIMIT 3')
q <- dbSendQuery(conn = con, 'SELECT * FROM covid19')
rec <- dbFetch(q)
#rec
dbClearResult(q)
#dbFetch(q)
dbDisconnect(conn = con)