-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcovid_pg_md.Rmd
78 lines (66 loc) · 3.04 KB
/
covid_pg_md.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
---
title: "covid_pg_md"
output: html_document
date: "2023-09-21"
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## R Markdown
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
```{r}
#install.packages(("writexl"))
library(writexl)
library(tidyverse)
library(lubridate)
library(dplyr)
library(writexl)
library(ggplot2)
library(janitor)
library(readxl)
```
```{r}
data <- read_csv('cases_by_county.csv')
data <- data %>%
mutate(
difference_Allegany = Allegany - lag(Allegany),
difference_Anne_Arundel = Anne_Arundel - lag(Anne_Arundel),
difference_Baltimore = Baltimore - lag(Baltimore),
difference_Baltimore_City = Baltimore_City - lag(Baltimore_City),
difference_Calvert = Calvert - lag(Calvert),
difference_Caroline = Caroline - lag(Caroline),
difference_Carroll = Carroll - lag(Carroll),
difference_Cecil = Cecil - lag(Cecil),
difference_Charles = Charles - lag(Charles),
difference_Dorchester = Dorchester - lag(Dorchester),
difference_Frederick = Frederick - lag(Frederick),
difference_Garrett = Garrett - lag(Garrett),
difference_Harford = Harford - lag(Harford),
difference_Howard = Howard - lag(Howard),
difference_Kent = Kent - lag(Kent),
difference_Montgomery = Montgomery - lag(Montgomery),
difference_Prince_Georges = Prince_Georges - lag(Prince_Georges),
difference_Queen_Annes = Queen_Annes - lag(Queen_Annes),
difference_Somerset = Somerset - lag(Somerset),
difference_St_Marys = St_Marys - lag(St_Marys),
difference_Talbot = Talbot - lag(Talbot),
difference_Washington = Washington - lag(Washington),
difference_Wicomico = Wicomico - lag(Wicomico),
difference_Worcester = Worcester - lag(Worcester)
)
# victoria - we only used PG so just doing this for ease
correct_data <- data %>%
select(DATE, difference_Prince_Georges, Prince_Georges)
# victoria - the first row in this is incorrect, but we can just put 9 in on the graphic it's fine.
# hic checked
```
```{r}
# victoria - commenting this out cuz we only using PG
#correct_data <- data %>%
#select("DATE", "difference_Allegany", "difference_Anne_Arundel", "difference_Baltimore", "difference_Baltimore_City", "difference_Calvert", "difference_Caroline", "difference_Carroll", "difference_Cecil", "difference_Charles", "difference_Dorchester", "difference_Frederick", "difference_Garrett", "difference_Harford", "difference_Howard", "difference_Kent", "difference_Montgomery", "difference_Prince_Georges", "difference_Queen_Annes", "difference_Somerset", "difference_St_Marys", "difference_Talbot", "difference_Washington", "difference_Wicomico", "difference_Worcester")
print(correct_data)
```
```{r}
write_xlsx(correct_data, "final_pg_md_data.xlsx")
```