df <- read.csv ('https://raw.githubusercontent.com/ulklc/covid19-
timeseries/master/countryReport/raw/rawReport.csv',
stringsAsFactors = FALSE)
df1 <- aggregate(death ~ countryName, subset(df), sum)
我创建了具有死亡人数的数据集。
以线图绘制死亡人数最多的五个国家的死亡人数。
library(ggplot2)
df <- read.csv ('https://raw.githubusercontent.com/ulklc/covid19-timeseries/master/countryReport/raw/rawReport.csv', stringsAsFactors = FALSE)
df1 <- aggregate(death ~ countryName, subset(df), sum)
top_10_coutries <- df1[order(df1$death,decreasing = T),][1:10,]$countryName
to_plot = df[df$countryName %in% top_10_coutries,]
ggplot(data=to_plot, aes(x=day, y=death, group=countryName)) +
geom_line(aes(color=countryName))+
geom_point(aes(color=countryName))+ theme(axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank())