数据集中的数据行与总数据的比较

df <- read.csv ('https://raw.githubusercontent.com/ulklc/covid19- 
                 timeseries/master/countryReport/raw/rawReport.csv',
                stringsAsFactors = FALSE)

yesterday <- function() Sys.Date() - 1L
yesterday()
# [1] "if it doesn't work yesterday()-1  do it"
# Data in DF is being updated. but sometimes it's too late. Please check if yesterday 
# command might have problem.

df3 <- aggregate(confirmed  ~ countryName, subset(df,day == yesterday()-2), sum)

df10 <-  aggregate(confirmed  ~ confirmed, subset(df), sum)

我找到了确认的数量。但是,我想得到的确认最多的三个国家在那里。

这是3个国家/地区的信息,占确认总数的百分比。

作为输出:

date         countryName     confirmed     total-confirmed       percent (%)
2020/05/05    Spain           19800           92108838            0,0158554
2020/05/05    italy           19800           92108838            0,0158554
2020/05/05    iran            19800           92108838            0,0158554

数据不是一个例子。不是真实的。

在这里需要日期以确保收到前一天的数据