# Combine Flues Data into one file # Michael D Cayton # December 7th, 2022 #### Load the libraries ### library("tidyverse") # Load dplyr package library("plyr") # Load plyr package library("readr") # Load readr package # Set the url for the ftp site working directory. # This is where the origianal data is stored. url <- 'C:/Users/mdcay/Documents/Happy Dad/ns41flues/' data_all <- list.files(path = url, # Identify all CSV files pattern = "*.flue", full.names = TRUE) %>% lapply(read_delim, delim=' ', col_names = FALSE, show_col_types = FALSE) %>% # Store all files in list bind_rows # Combine data sets into one data set data_all # Print data to RStudio console test <- NULL test <- cbind(test, sapply(data_all[3:21], sprintf, fmt = "%.4e")) df <- NULL df <- cbind(data_all[1:2], test) # Save table. write_delim(df, file="/Users/mdcay/Documents/Happy Dad/ns41flues/ns41gwk_combined.flue", delim= '\s\s', col_names = FALSE)