Repository navigation
Expand file tree
/
Copy pathexample.Rmd
More file actions
88 lines (59 loc) · 1.73 KB
/
Copy pathexample.Rmd
File metadata and controls
88 lines (59 loc) · 1.73 KB
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
---
title: "Thursday Example"
author: "Derek Ouyang"
date: "9/23/2021"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r}
library(tidyverse)
health_full <- read_csv("https://chronicdata.cdc.gov/api/views/swc5-untb/rows.csv?accessType=DOWNLOAD&bom=true&format=true")
head(health_full)
```
```{r}
write_csv(health_full, "health_full.csv")
health_full_again <- read_csv("health_full.csv")
# comments to myself
rm(health_full_again)
```
comments to myself
```{r}
year <- 2020
quarters <- 1:4
type <- "Electric"
pge_20_elec <- NULL
for(quarter in quarters) {
filename <-
paste0(
"pge/PGE_",
year,
"_Q",
quarter,
"_",
type,
"UsageByZip.csv"
)
print(filename)
temp <- read_csv(filename)
pge_20_elec <- rbind(pge_20_elec,temp)
# Note rbind requires field names to be consistent for every new thing that you add.
saveRDS(pge_20_elec, "pge_20_elec.rds")
}
```
```{r}
pge_filter <- filter(pge_20_elec, CUSTOMERCLASS %in% c("Elec- Residential","Elec- Commercial"))
```
## 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 cars}
summary(cars)
```
## Including Plots
You can also embed plots, for example:
```{r pressure, echo=FALSE}
plot(pressure)
```
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.