Batch Processing Repeat the exercise from the Batch Processing Lecture (7th April), but do it using real data sets rather than purely simulated. Check with folks in your lab to see if there are multiple data sets available for analysis. Stick to simple data analyses and graphics, but try to set it up as a batch process that will work on multiple files and save summary results to a common file.

# -------------------------------

##########################################################
# Global variables
file_folder <- "Photosynthesis/"
file_out <- "StatsSummary.csv"
file_names <- list.files(path = file_folder)
##########################################################



# Create a data frame to hold summary file statistics
ID <- seq_along(file_names)
file_name <- file_names
summary <- rep(NA, length(file_names))


stats_out <- data.frame(ID, file_name, summary)
# batch process by looping through individual files
for(i in seq_along(file_names)){
  data <- read.table(file = paste(file_folder,file_names[i],sep = ""),
                     sep=",", 
                     header = TRUE,
                     stringsAsFactors = FALSE)
  
  write.table(x=data,
              file=file_out,
              row.names=FALSE,
              col.names=FALSE,
              sep=",",
              append=TRUE,
              quote=FALSE)
}



print(stats_out)
##   ID                       file_name summary
## 1  1 survey_measurements_6-17-21.csv      NA
## 2  2  survey_measurements_6-9-21.csv      NA
## 3  3 survey_measurements_7-10-21.csv      NA
## 4  4 Survey_Measurements_8.16.21.csv      NA
#Still trying to figure out how to get calculatoins--photosythesis/conductance, will have this completed this evening 4/20