Skip to content

Commit 0fad5a2

Browse files
authored
Add files via upload
1 parent 01a0ffa commit 0fad5a2

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

visualization_proportions.Rmd

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
title: "Data visualization proportion"
3+
author: "Md Easin Hasan"
4+
date: "3/28/2021"
5+
output: word_document
6+
---
7+
8+
```{r}
9+
data<-read.csv(file="owid-covid-data_new.csv",header=TRUE)
10+
dim(data)
11+
12+
USA_20 <- data[74514:74514, ]
13+
UK_20 <- data[74081:74081, ]
14+
CAN_20 <- data[13100:13100, ]
15+
FRA_20 <- data[25899:25899, ]
16+
ITA_20 <- data[35349:35349, ]
17+
data_20<-rbind(USA_20,UK_20,CAN_20,FRA_20,ITA_20)
18+
data_f20 <- data_20[,c(1,4,8)]
19+
20+
USA_21 <- data[74602:74602, ]
21+
UK_21 <- data[74169:74169, ]
22+
CAN_21 <- data[13188:13188, ]
23+
FRA_21 <- data[25987:25987, ]
24+
ITA_21 <- data[35437:35437, ]
25+
data_21<-rbind(USA_21,UK_21,CAN_21,FRA_21,ITA_21)
26+
data_f21 <- data_21[,c(1,4,8)]
27+
data_final <- rbind(data_f20,data_f21)
28+
29+
```
30+
31+
```{r}
32+
#library(tidyverse)
33+
#library(magrittr)
34+
library(ggplot2)
35+
#library(reshape2)
36+
#library(scales)
37+
38+
ggplot(data_final, aes(x = date, y = total_deaths, fill = iso_code)) +
39+
xlab("Years") + ylab("Total deaths")+
40+
geom_bar(stat="identity", position = 'dodge')+
41+
geom_col()+
42+
scale_x_discrete(name = "Countries", labels=c("2020-12-31" = "2020", "2021-03-29" = "2021"))+
43+
scale_y_continuous(name="Total deaths")
44+
```
45+
46+
From this data visualization, we can see the total deaths due to Covid-19 in Canada, France, Great Britain, Italy, and United States respectively.
47+
48+
## Data visualization proportion improvement:
49+
50+
```{r}
51+
52+
plot <- ggplot(data_final, aes(date, total_deaths, fill=iso_code))
53+
plot <- plot + geom_bar(stat = "identity", position = 'dodge')+
54+
scale_x_discrete(name = "Years", labels=c("2020-12-31" = "2020", "2021-03-29" = "2021"))+
55+
scale_y_continuous(name="Total deaths")
56+
plot
57+
```
58+
59+
From this data visualization, we can see the total deaths due to Covid-19 in Canada, France, Great Britain, Italy, and United States in 2020 and 2021 respectively. The number of total deaths very higher in USA compare to other countries.

0 commit comments

Comments
 (0)