-
Notifications
You must be signed in to change notification settings - Fork 0
/
1601366070936_ques2_3.rmd
80 lines (53 loc) · 1.89 KB
/
1601366070936_ques2_3.rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
---
title: "ques2_3"
author: "Somya Singhal(S3813520)"
date: "29/09/2020"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## R Markdown
```{r cars}
library(tidyr)
library(dplyr)
library(readr)
library(readxl)
library(magrittr)
library(lattice)
library(ggplot2)
library(lubridate)
#South korea, new zealand,iceland,australia,greece
#2)As a government, I want to know how GDP is affecting to figure out some other measures to improve the conditions.
#3)As a government, I want to know how the stringent measures is related to total deaths.
covid_data <- read_csv("covid-data.csv")
head(covid_data)
# data preparation
colnames(covid_data)
str(covid_data)
#plot cases
c<-covid_data %>% filter(location == 'South Korea' | location == 'New Zealand'
| location == 'Iceland'| location == 'Australia'
| location == 'Greece')
comb<-covid_data %>% filter((location == 'South Korea' | location == 'New Zealand'
| location == 'Iceland'| location == 'Australia'
| location == 'Greece' ) & date=="2020-08-11")
```
```{r}
#ques 2
ggplot(comb,aes(x=gdp_per_capita,y=total_cases,colour=location,group=location,fill=location))+
geom_point()+
scale_y_continuous(breaks = seq(0,50000,10000)) +
labs(title = " Effect on GDP of different countries based on total cases",
x = "GDP",
y = "Total cases") +
theme(axis.text.x = element_text(angle = 90,vjust = 0.5))
#ques3
ggplot(c,aes(x=stringency_index,y=total_cases,colour=location,group=location,fill=location))+
geom_line(size = 0.7)+
scale_y_continuous(breaks = seq(0,50000,10000)) +
labs(title = " Effect of stringent measures on covid cases",
x = "stringency index",
y = "The number of total cases") +
theme(axis.text.x = element_text(angle = 90,vjust = 0.5))
```