USGS-R / RSPARROW

A system of R scripts and functions for executing and evaluating SPARROW surface water-quality models that generates graphical, map, and tabular output.
Other
25 stars 13 forks source link

Error in complete.cases(x.neg, x.pos, y.neg, y.pos) : object 'x.neg' not found #8

Open VincentYang147 opened 1 year ago

VincentYang147 commented 1 year ago
    > When I use this model, I recieved this:

Running correlations among explanatory variables... Error in complete.cases(x.neg, x.pos, y.neg, y.pos) : object 'x.neg' not found

Traceback: 23: complete.cases(x.neg, x.pos, y.neg, y.pos) 22: eval(substitute(expr), data, enclos = parent.frame()) 21: eval(substitute(expr), data, enclos = parent.frame()) 20: with.default(out, { good <- complete.cases(x.neg, x.pos, y.neg, y.pos) envelope(x.neg[good], x.pos[good], y.neg[good], y.pos[good], col = col.spread, alpha = alpha, border = border) }) 19: with(out, { good <- complete.cases(x.neg, x.pos, y.neg, y.pos) envelope(x.neg[good], x.pos[good], y.neg[good], y.pos[good], col = col.spread, alpha = alpha, border = border) }) 18: smoother(x[subs], y[subs], col = smoother.args$col[i], log.x = FALSE, log.y = FALSE, spread = spread, smoother.args = smoother.args) 17: lower.panel(...) 16: localLowerPanel(as.vector(x[, j]), as.vector(x[, i]), ...) 15: pairs.default(x, labels = var.labels, cex.axis = cex.axis, cex.main = cex.main, cex.labels = cex.labels, cex = cex, diag.panel = diag, row1attop = row1attop, panel = function(x, y, ...) { for (i in 1:n.groups) { subs <- groups == levels(groups)[i] if (plot.points) points(x[subs], y[subs], pch = pch[i], col = col[if (n.groups == 1) 1 else i], cex = cex) if (by.groups) { if (is.function(smoother)) smoother(x[subs], y[subs], col = smoother.args$col[i], log.x = FALSE, log.y = FALSE, spread = spread, smoother.args = smoother.args) if (is.function(reg.line)) regLine(reg.line(y[subs] ~ x[subs]), lty = lty, lwd = lwd, col = regLine.args$col[i]) if (ellipse) dataEllipse(x[subs], y[subs], plot.points = FALSE, ... 14: pairs(x, labels = var.labels, cex.axis = cex.axis, cex.main = cex.main, cex.labels = cex.labels, cex = cex, diag.panel = diag, row1attop = row1attop, panel = function(x, y, ...) { for (i in 1:n.groups) { subs <- groups == levels(groups)[i] if (plot.points) points(x[subs], y[subs], pch = pch[i], col = col[if (n.groups == 1) 1 else i], cex = cex) if (by.groups) { if (is.function(smoother)) smoother(x[subs], y[subs], col = smoother.args$col[i], log.x = FALSE, log.y = FALSE, spread = spread, smoother.args = smoother.args) if (is.function(reg.line)) regLine(reg.line(y[subs] ~ x[subs]), lty = lty, lwd = lwd, col = regLine.args$col[i]) if (ellipse) dataEllipse(x[subs], y[subs], plot.points = FALSE, ... 13: scatterplotMatrix.default(sdf, diagonal = "boxplot", reg.line = FALSE, use = "pairwise.complete.obs", spread = FALSE, smooth = TRUE) 12: scatterplotMatrix(sdf, diagonal = "boxplot", reg.line = FALSE, use = "pairwise.complete.obs", spread = FALSE, smooth = TRUE) 11: correlationMatrix(file.output.list, SelParmValues, subdata) 10: startModelRun(file.output.list, if_estimate, if_estimate_simulation, if_boot_estimate, if_boot_predict, enable_ShinyApp, filter_data1_conditions, data1, if_userModifyData, data_names, class.input.list, min.sites.list, if_validate, iseed, pvalidate, mapping.input.list, estimate.input.list, if_predict, biters, scenario.input.list, compare_models, modelComparison_name, if_spatialAutoCorr, add_vars, batch_mode, RSPARROW_errorOption) 9: executeRSPARROW(settingValues = lapply(settingsEnv, get), settingNames = settingsEnv, activeFile, envir = .GlobalEnv) 8: eval(ei, envir) 7: eval(ei, envir) 6: withVisible(eval(ei, envir)) 5: source(paste(path_master, "/R/runRsparrow.R", sep = "")) 4: eval(ei, envir) 3: eval(ei, envir) 2: withVisible(eval(ei, envir)) 1: source("E:/Coding/R/RSPARROW_UserTutorial/results/sparrow_control.R")

ShuaiGe57 commented 1 year ago

Use the data in Model1 ~ 8 instead of the default data in results

KlausWu commented 1 year ago

Do you mean the data in excle? Such as using Model1_dataDictionary to replace the dataDictionary

Use the data in Model1 ~ 8 instead of the default data in results

ShuaiGe57 commented 1 year ago

Do you mean the data in excle? Such as using Model1_dataDictionary to replace the dataDictionary

Use the data in Model1 ~ 8 instead of the default data in results

yes,include the control file

KlausWu commented 1 year ago

Do you mean the data in excle? Such as using Model1_dataDictionary to replace the dataDictionary

Use the data in Model1 ~ 8 instead of the default data in results

yes,include the control file Thank you very much! It worked!

zingzxyang commented 1 year ago

Do you mean the data in excle? Such as using Model1_dataDictionary to replace the dataDictionary

Use the data in Model1 ~ 8 instead of the default data in results

yes,include the control file Thank you very much! It worked!

hello, please tell me more details about how to use Model1_dataDictionary to replace the dataDictionary, thank you very much!!!

KlausWu commented 1 year ago

Just copy and pasete all the file in Model1 file.

zingzxyang commented 1 year ago

Just copy and pasete all the file in Model1 file.

ok, thank you so much! I have successfully solved this problem and ran the model.

KlausWu commented 10 months ago

Do you mean the data in excle? Such as using Model1_dataDictionary to replace the dataDictionary

Use the data in Model1 ~ 8 instead of the default data in results

yes,include the control file

When I use my own data, I recieved this: Error in calcDemtareaClass(sitedata$demtarea) (from calcDemtareaClass.R#30) : object 'demtarea.class' not found

Traceback: 11: calcDemtareaClass(sitedata$demtarea) 10: startModelRun(file.output.list, if_estimate, if_estimate_simulation, if_boot_estimate, if_boot_predict, enable_ShinyApp, filter_data1_conditions, data1, if_userModifyData, data_names, class.input.list, min.sites.list, if_validate, iseed, pvalidate, mapping.input.list, estimate.input.list, if_predict, biters, scenario.input.list, compare_models, modelComparison_name, if_spatialAutoCorr, add_vars, batch_mode, RSPARROW_errorOption) 9: executeRSPARROW(settingValues = lapply(settingsEnv, get), settingNames = settingsEnv, activeFile, envir = .GlobalEnv) 8: eval(ei, envir) 7: eval(ei, envir) 6: withVisible(eval(ei, envir)) 5: source(paste(path_master, "/R/runRsparrow.R", sep = "")) 4: eval(ei, envir) 3: eval(ei, envir) 2: withVisible(eval(ei, envir)) 1: source("E:/SPARROWyax/rsparrow-master/UserTutorial/results/sparrow_control.R")

RSPARROW SYSTEM ERROR OCCURRED To reset user options in R use options(backupOptions)

Can you give me some advice ,thanks!

ShuaiGe57 commented 10 months ago

does your data.csv file has demtarea column?

KlausWu commented 10 months ago

does your data.csv file has demtarea column?

Yes!And each subwatershed has a corresponding value. QAQ image