USEPA / SSN2

SSN2: Spatial Modeling on Stream Networks in R
https://usepa.github.io/SSN2/
GNU General Public License v3.0
16 stars 3 forks source link

Default Options for ssn_glm() #8

Closed highamm closed 11 months ago

highamm commented 11 months ago

Hello!

I expected the code below to work because I thought the family argument would default to "Gaussian", as stated in the function documentation. But there is a strange error: "Error in as.call(call_list) : invalid length 0 argument."

This error was on the CRAN installation of SSN2.

library(SSN2)

copy_lsn_to_temp()
path <- paste0(tempdir(), "/MiddleFork04.ssn")
mf04p <- ssn_import(path, predpts = "pred1km")
ssn_create_distmat(mf04p, predpts = "pred1km", overwrite = TRUE)

ssn_mod <- ssn_glm(
  formula = Summer_mn ~ ELEV_DEM + AREAWTMAP,
  ## family = "Gaussian", ## function works if this line is not commented
  ssn.object = mf04p,
  tailup_type = "exponential",
  taildown_type = "spherical",
  euclid_type = "gaussian",
  additive = "afvArea"
)
summary(ssn_mod)
michaeldumelle commented 11 months ago

Thanks @highamm . The documentation is incorrect; there should not be a default for family. We have updated the documentation accordingly and added an error message when family is missing. These changes are implemented in the development version of SSN2, which you can download by running

remotes::install_github("USEPA/SSN2", ref = "develop")

On CRAN, the changes will be reflected in the next version (the current CRAN version is 0.1.0).