Try this:
URL <- "https://raw.githubusercontent.com/datasets/covid-19/master/time-series-19-covid-combined.csv"
data <- read.csv(url(URL), stringsAsFactors = FALSE) # important !
str(data) # Always check before continuing further
'data.frame': 12768 obs. of 8 variables:
$ Province.State: Factor w/ 164 levels "","Alameda County, CA",..: 4 4 4 4 4 4 4 4 4 4 ...
$ Country.Region: Factor w/ 111 levels "Afghanistan",..: 60 60 60 60 60 60 60 60 60 60 ...
$ Lat : num 31.8 31.8 31.8 31.8 31.8 ...
$ Long : num 117 117 117 117 117 ...
$ Date : chr "2020-01-22" "2020-01-23" "2020-01-24" "2020-01-25" ...
$ Confirmed : int 1 9 15 39 60 70 106 152 200 237 ...
$ Recovered : int 0 0 0 0 0 0 0 2 2 3 ...
$ Deaths : int 0 0 0 0 0 0 0 0 0 0 ...
Note that the "Date" is character. You need to convert it into a "Date" class
library(dplyr)
data <- data %>%
mutate(Date = as.Date(Date))
Confirmed <- data %>%
filter(Date=="2020-03-12") %>%
group_by(Country.Region) %>%
summarise(Confirmed = sum(Confirmed)) %>%
arrange(desc(Confirmed))
# A tibble: 0 x 2
# ... with 2 variables: Country.Region <chr>, Confirmed <int>