[I am trying to use a sequenced list of depth values as an input in my creation of an array, but it's not working. Keep getting the same error message "negative length vectors not allowed. Help?][1]
Here's the code:
#minimum elevation (ft)
minelev <- 6228
# Maximum elevation (ft)
maxelev <- 6303
# standard sequence of depth values
depthSeq <- seq(minelev, maxelev, 0.1)
# data collected
vars <- c("ODO*", "Temp", "Cond", "Chlorophyll", "BGA", "PC_Chla")
varnames <- c("ODO", "Temp", "Cond", "Chlorophyll", "BGA", "PC_Chla")
Dates <- c()
Locations <- c()
for (i in 1:length(interpfiles)) {
strg <- unlist(strsplit(
x = interpfiles[i],
split = ".",
fixed = T
))
Dates[i] <- paste(strg[2], strg[3], strg[4], sep = "/")
Locations[i] <- strg[1]
} #ends for loop
#simpler attempt for creating empty arrays for each site location before adding columns of additional interpolated data
row.names<-c()
col.names<-c("Depth", Dates)
mat.names<-c(varnames)
Gates.array<-array(NA, dim = c(depthSeq,229,6), dimnames = list(NULL,col.names,varnames))