Initial commit: illustrative R data pipeline
This commit is contained in:
17
scripts/08_format.R
Normal file
17
scripts/08_format.R
Normal file
@@ -0,0 +1,17 @@
|
||||
# 07_format.R
|
||||
# Reads final result, rounds all numeric columns to 2 decimal places.
|
||||
|
||||
source("scripts/00_paths.R")
|
||||
|
||||
library(readr)
|
||||
library(dplyr)
|
||||
|
||||
df <- read_csv(result, show_col_types = FALSE)
|
||||
|
||||
df_formatted <- df |>
|
||||
mutate(across(where(is.numeric), ~ round(.x, 2)))
|
||||
|
||||
write_csv(df_formatted, formatted)
|
||||
|
||||
cat("07_format.R: rounded to 2 decimals, wrote df_formatted.csv\n")
|
||||
print(df_formatted)
|
||||
Reference in New Issue
Block a user