You'll need to make a few adjustments:
library(tidyverse)
csv_files <- list.files("my_directory", pattern = ".csv", full.names = TRUE) # edit "my_directory"
combined_long <-
map_dfr(
csv_files,
read_csv,
col_names = c("datetime", "temp", "rh", "dp", "hc", "eof") # cleaned column names
.id = "file_name"
)
# change the file names to something short before running the next chunk
combined_wide <-
pivot_wider(
combined_long,
names_from = file_name,
values_from = c(temp, rh, dp, hc, eof)
)