How to read and merge multiple csv files in a folder as a data frame using Rstudio so that new csv file be added to the data frame as a new column?

I have 19 CSV files in a folder. each CSV file has 6 columns (Date,temperature,RH, Dewpt, Host, EOF). I want to merge all of the 19 files into a single data frame using Rstudio. For this, I need the new CSV files to be added as new columns. In another word, when the second file is merged with the first one, I want to see 11 columns(I just need one Date for all the cases), and when 3 files are merged I want to see 16 columns and so on. how can I do that? Also in the first cell of each file, there is a serial number for each CSV file. I want to add them as ID of each csv file as you can see in the attached pictures. I really appreciate your help. Thank you

You'll need to make a few adjustments:


csv_files <- list.files("my_directory", pattern = ".csv", full.names = TRUE) # edit "my_directory"

combined_long <- 
    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 <- 
    names_from = file_name, 
    values_from = c(temp, rh, dp, hc, eof)