-
Notifications
You must be signed in to change notification settings - Fork 0
/
.Rhistory
188 lines (188 loc) · 7.62 KB
/
.Rhistory
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
renv::init()
renv::upgrade()
renv::snapshot()
install.packages("rAmCharts")
install.packages("flexdashboard")
install.packages("flexdashboard")
install.packages("rAmCharts")
install.packages("thematic")
if (requireNamespace("thematic"))
thematic::thematic_rmd(font = "auto")
#packages for data manipulation
library(readr)
library(dplyr)
library(plyr)
library(sf)
if (requireNamespace("thematic"))
thematic::thematic_rmd(font = "auto")
#packages for data manipulation
library(readr)
library(dplyr)
library(plyr)
library(sf)
library(rAmCharts)
#loading COVID-19 India data and filtering for 1st oct 2021
data_whole<-read.csv("states.csv")
data_ex <- read_csv("states.csv")%>%
filter(Date=="2021-10-01")%>%
filter(State!="India")%>%
select(c("State","Confirmed"))%>%
arrange(State)
State <- as.character(data_ex$State)
#loading shape file and merging with covid19 data
map_data <- read_sf("India_State_Shapefile/India_State_Shapefile/India_State_Boundary.shp")%>%
arrange(Name)%>%
cbind(State,.)%>%
merge(.,data_ex,by="State")%>%
st_as_sf()
#loading packages to build map
library(tmap)
library(tmaptools)
pal=get_brewer_pal("-RdYlGn", n = 5,contrast = c(0.4,1))
if (requireNamespace("thematic"))
thematic::thematic_rmd(font = "auto")
#packages for data manipulation
library(readr)
library(dplyr)
library(plyr)
library(sf)
library(rAmCharts)
#loading COVID-19 India data and filtering for 1st oct 2021
data_whole<-read.csv("states.csv")
data_ex <- read_csv("states.csv")%>%
filter(Date=="2021-10-01")%>%
filter(State!="India")%>%
select(c("State","Confirmed"))%>%
arrange(State)
State <- as.character(data_ex$State)
#loading shape file and merging with covid19 data
map_data <- read_sf("India_State_Shapefile/India_State_Shapefile/India_State_Boundary.shp")%>%
arrange(Name)%>%
cbind(State,.)%>%
merge(.,data_ex,by="State")%>%
st_as_sf()
#loading packages to build map
library(tmap)
library(tmaptools)
pal=get_brewer_pal("-RdYlGn", n = 5,contrast = c(0.4,1))
#building static map
map_static<-tm_shape(map_data) +
tm_fill(col = "Confirmed",style = "quantile", alpha=1, palette = pal)+
tm_bubbles(size = "Confirmed",col="Confirmed",palette="Greys")+
tm_text("State",remove.overlap=T, size=0.5)+
tm_borders(col="grey",lwd=1, alpha = 1)+
tm_layout(frame = F)+
tm_compass(type = "4star",show.labels = 1,size=2, position = c("left", "bottom"))+
tm_credits("Source: https://www.covid19india.org/",position = c("left", "bottom"))+
tm_legend(legend.outside=T,legend.outside.position=c("right","bottom"),title="Total Confirmed Cases")
tmap_mode("plot")
#ploting the Static Map
map_static
lattice::show.settings()
#building the interective map
map_interective<-tm_shape(map_data) +
tm_fill(col = "Confirmed",style = "quantile", alpha=1, palette = pal,popup.vars = c("State","Confirmed"))+
tm_bubbles(size = "Confirmed",col = "Confirmed",interactive=T,popup.vars="Confirmed",palette="Greys",legend.size.show=F)+
tm_text("State",size=0.5)+
tm_borders(col="grey",lwd=1,alpha = 0.5)+
tm_layout(frame = T, outer.margins = 0, inner.margins = 0,bg.color="lightblue")+
tm_view(set.view = 4, alpha = 1, set.zoom.limits=c(3,8),view.legend.position=c("right","top") )+
tm_legend(legend.outside=T,legend.outside.position=c("right","bottom"),title="Total Confirmed Cases")
tmap_mode("view")
#ploting the Interective COVID-19 India Map
map_interective
View(data_whole)
View(data_whole)
#ploting the Interective COVID-19 India Map
map_interective
amTimeSeries(data_whole, 'Date', c('Confirmed', 'Recovered','Deceased'),bullet = 'round',linewidth = c(3,3,3))
amTimeSeries(data_whole, 'Date', c('Confirmed', 'Recovered','Deceased'),bullet = 'round',linewidth = c(3,3,3))
amTimeSeries(data_whole, 'Date', c('Confirmed', 'Recovered'),bullet = 'round',linewidth = c(3,3))
date<-data_whole$Date %>% as.Date()
date
data_whole<-cbind(date,data_whole)
View(data_whole)
amTimeSeries(data_whole, 'date', c('Confirmed', 'Recovered'),bullet = 'round',linewidth = c(3,3))
date<-data_whole$Date %>% as.Date() %>% as.POSIXct()
data_whole<-cbind(date,data_whole)
amTimeSeries(data_whole, 'date', c('Confirmed', 'Recovered'),bullet = 'round',linewidth = c(3,3))
states <- as.character(unique(data_whole$State))
state
states
state_wise = list()
for (i in 1:length(states)) {
state_wise[[i]] <- data_whole%>%filter(state==states[i])
}
state_wise = list()
for (i in 1:length(states)) {
state_wise[[i]] <- data_whole%>%filter(State==states[i])
}
state_wise = list()
for (i in 1:length(states)) {
state_wise[[i]] <- data_whole%>%filter(. State == states[i])
i
state_wise = list()
for (i in 1:length(states)) {
state_wise[[i]] <- data_whole%>%filter(., State == states[i])
}
state_wise = list()
for (i in 1:length(states)) {
state_wise[[i]] <- data_whole%>%subset(., State == states[i])
}
state_wise
typeof(state_wise)
state_wise = list()
for (i in 1:length(states)) {
state_wise[[i]] <- data_whole%>%subset(., State == states[i])
amTimeSeries(state_wise[[i]], 'date', c('Confirmed', 'Recovered'),bullet = 'round',linewidth = c(3,3))%>%plot()
}
date<-data_whole$Date %>% as.Date() %>% as.POSIXct()
data_whole<-cbind(date,data_whole)
states <- as.character(unique(data_whole$State))
state_wise = list()
for (i in 1:length(states)) {
state_wise[[i]] <- data_whole%>%subset(., State == states[i])
amTimeSeries(state_wise[[i]], 'date', c('Confirmed', 'Recovered'),bullet = 'round',linewidth = c(3,3))%>%plot()
}
date<-data_whole$Date %>% as.Date() %>% as.POSIXct()
data_whole<-cbind(date,data_whole)
states <- as.character(unique(data_whole$State))
state_wise = list()
par(mfrow=c(length(states),1))
for (i in 1:length(states)) {
state_wise[[i]] <- data_whole%>%subset(., State == states[i])
amTimeSeries(state_wise[[i]], 'date', c('Confirmed', 'Recovered'),bullet = 'round',linewidth = c(3,3))%>%plot()
}
date<-data_whole$Date %>% as.Date() %>% as.POSIXct()
data_whole<-cbind(date,data_whole)
states <- as.character(unique(data_whole$State))
state_wise = list()
par(mfrow=c(length(states),1))
for (i in 1:length(states)) {
state_wise[[i]] <- data_whole%>%subset(., State == states[i])
amTimeSeries(state_wise[[i]], 'date', c('Confirmed', 'Recovered'),bullet = 'round',linewidth = c(3,3))
}
state_wise <- data_whole%>%subset(., State == "Bihar")
amTimeSeries(state_wise, 'date', c('Confirmed', 'Recovered'),bullet = 'round',linewidth = c(3,3))
state_wise <- data_whole%>%subset(., State == "India")
amTimeSeries(state_wise, 'date', c('Confirmed', 'Recovered','Deceased'),bullet = 'round',linewidth = c(3,3,3))
date<-data_whole$Date %>% as.Date() %>% as.POSIXct()
data_whole<-cbind(date,data_whole)
states <- as.character(unique(data_whole$State))
state_wise <- data_whole%>%subset(., State == "India")
amTimeSeries(state_wise, 'date', c('Confirmed', 'Recovered','Deceased'),bullet = 'round',linewidth = c(3,3,3))
date<-data_whole$Date %>% as.Date() %>% as.POSIXct()
data_whole<-cbind(date,data_whole)
states <- as.character(unique(data_whole$State))
state_wise <- data_whole%>%subset(., State == "India")
amTimeSeries(state_wise, 'date', c('Confirmed', 'Recovered','Deceased'),bullet = 'round',linewidth = c(3,3,3),group = 'State', main = "Covid cases time series")
date<-data_whole$Date %>% as.Date() %>% as.POSIXct()
data_whole<-cbind(date,data_whole)
states <- as.character(unique(data_whole$State))
state_wise <- data_whole%>%subset(., State == "India")
amTimeSeries(data_whole, 'date', c('Confirmed', 'Recovered','Deceased'),bullet = 'round',linewidth = c(3,3,3),group = 'State', main = "Covid cases time series")
date<-data_whole$Date %>% as.Date() %>% as.POSIXct()
data_whole<-cbind(date,data_whole)
states <- as.character(unique(data_whole$State))
India <- data_whole%>%subset(., State == "India")
amTimeSeries(India, 'date', c('Confirmed', 'Recovered','Deceased'),bullet = 'round',linewidth = c(3,3,3),group = 'State', main = "Covid cases time series")