We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b4a74b9 commit ef1871fCopy full SHA for ef1871f
code/05_edit_data_types.R
@@ -0,0 +1,24 @@
1
+library(tidyverse)
2
+library(magrittr)
3
+library(lubridate)
4
+library(sf)
5
+library(dplyr)
6
+library(ggplot2)
7
+sf_use_s2(FALSE)
8
+
9
10
+# Loop through years 2006 to 2016
11
+for (year in 2006:2016) {
12
+ # Construct file names for input and output CSV files
13
+ input_file <- sprintf("../data/output/daily_zip_%d.csv", year)
14
+ output_file <- sprintf("../data/output/daily_zip/daily_zip_%d.csv", year)
15
16
+ # Read in the input CSV file
17
+ df <- read.csv(input_file)
18
19
+ # Convert zip column to character format with leading zeros
20
+ df$zip <- sprintf("%05d", df$zip)
21
22
+ # Save modified data frame as new CSV file
23
+ write.csv(df, output_file, row.names = FALSE)
24
+}
0 commit comments