Open philipbaileynar opened 2 years ago
#save each row in the database
for (i in 1:nrow(predsfinal)){
tryCatch({
if (predsfinal$isTemporal[i]==TRUE) {
NAMCr::save(
api_endpoint = "setSamplePredictorValue",
sampleId = predsfinal$sampleId[i],
predictorId = predsfinal$predictorId[i],
value = predsfinal$value[i]
)
} else{
NAMCr::save(
api_endpoint = "setSitePredictorValue",
siteId = predsfinal$siteId[i],
predictorId = predsfinal$predictorId[i],
value = predsfinal$value[i]
)
}
}, error = function(e) {
cat(paste0("\n\tERROR saving: ",predsfinal$sampleId[i]," ",predsfinal$predictorId[i],"\n"))
str(e,indent.str = " "); cat("\n")
})
}
The corresponding API endpoint has been tested and confirmed to be working. Therefore it must be something to do with the NAMCr save(0 function again.
I am running NAMCr 0.7.5
The call: