Hello,
I have a list of 17 tables containing precipitation data from CHIRPS and pluviometric stations.
The tables are organized as dates on the first column, simulated in the second, and observed in the third.
I want to create a for loop that calculates the hydroGOF::GOF metrics for all the tables.
Here's what I've got so far:
stations_files = list.files(wd,
full.names = TRUE,
pattern = "Est")
results <- vector(mode = "integer", length = length(stations_files))
for (i in 1:length(stations_files)){
station <- readxl::read_xlsx(stations_files[i])
gofstation <- gof(sim = station[, 2], obs = station[,3])
results[i] <- gofstation
}
Although I think I am passing the correct columns of simulated and observed data to the gof function, I keep getting the error:
Error in me.default(sim, obs, na.rm = na.rm) :
Invalid argument type: 'sim' & 'obs' have to be of class: c('integer', 'numeric', 'ts', 'zoo')
When I calculate the gof with a single table, I dont get the error regarding the class.
Thanks in advance!!