Dear All,

I am seeking direction on how to successfully recreate an CRAN check error (see 
email below) for the debian gcc platform (see attached log). I'm pretty 
confident that there is still an error associated with my code  calling if() 
with a vector of length 2 or more. However, the code is long and as there are 
likely multiple incidences, I really want to be able to recreate this error 
myself so I do not waste CRAN time resubmitting each time I fix one incidence.

I have tried multiple approaches to recreate this error without success. These 
include:
1) Running rhub::check while specifying environmental variables suggested by 
Brian Ripley 
('_R_CHECK_LENGTH_1_CONDITION'="package:_R_CHECK_PACKAGE_NAME_,abort,verbose") 
on the platform "debian-gcc-devel". Check proceeds with no errors but I suspect 
the environmental variables are not being correctly specified (see 
https://github.com/r-hub/rhub/issues/174)

2) Running devtools::check() in Rstudio 1.0.143. But as I am running on 
windows, the code compiles OK.
My system:

platform       x86_64-w64-mingw32
arch           x86_64
os             mingw32
system         x86_64, mingw32
status         Under development (unstable)
major          3
minor          6.0
year           2018
month          10
day            15
svn rev        75443
language       R
version.string R Under development (unstable) (2018-10-15 r75443)
nickname       Unsuffered Consequences

3) I have set up a GitHub profile and repository for the current code of my 
package FlexParamCurve v 1.5-5 (https://github.com/sao10/FlexParamCurve1.5-5). 
I have then used Travis to build and check it 
(https://travis-ci.org/sao10/FlexParamCurve1.5-5/jobs/457270859) but, I am 
pretty certain that my environmental variables are not transferring. I tried 
setting them as Global Environmental Variables and also in my .travis.yml file. 
 My config was:

{
  "os": "linux",
  "dist": "trusty",
  "sudo": false,
  "cache": "packages",
  "group": "stable",
  "language": "r",
  "global_env": "_R_CHECK_LENGTH_1_CONDITION = 
\"package:_R_CHECK_PACKAGE_NAME_,abort,verbose\" R_C_BOUNDS_CHECK = yes 
_R_CHECK_FORCE_SUGGESTS_ = false"
}


and my .travis.yml file was:

language: R
cache: packages
sudo: false
env:
    global:
    - _R_CHECK_LENGTH_1_CONDITION = 
"package:_R_CHECK_PACKAGE_NAME_,abort,verbose"
    - R_C_BOUNDS_CHECK = yes
    - _R_CHECK_FORCE_SUGGESTS_ = false


One possibility I have yet to explore is potentially running debian from a 
flash drive but I'm not sure whether my tool chains would need to change and it 
seems a major undertaking. Currently my tool chain looks like this:

C:\Rtools\bin;C:\Rtools\mingw_64\bin;C:\Strawberry\c\bin;C:\Program Files 
(x86)\MiKTeX 2.9\miktex\bin; 
H:\R\R-devel\bin\x64;C:\Strawberry\perl\site\bin;C:\Strawberry;C:\Program Files 
(x86)\Common Files\Adobe\AGL;C:\Program Files (x86)\Calibre2\;C:\Program Files 
(x86)\Skype\Phone\

and I am running
Rtools version 3.5.0.4
MiKTeX 2.9

R Under development (unstable) (2018-10-15 r75443)

Thank you for any direction you may be able to offer.

Steve.





________________________________
From: lig...@statistik.tu-dortmund.de <lig...@statistik.tu-dortmund.de>
Sent: Saturday, November 10, 2018 2:21 AM
To: Oswald, Stephen A
Cc: cran-submissi...@r-project.org
Subject: [CRAN-pretest-archived] CRAN submission FlexParamCurve 1.5-4

Dear maintainer,

package FlexParamCurve_1.5-4.tar.gz does not pass the incoming checks 
automatically, please see the following pre-tests:
Windows: 
<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwin-builder.r-project.org%2Fincoming_pretest%2FFlexParamCurve_1.5-4_20181110_081104%2FWindows%2F00check.log&amp;data=02%7C01%7Csao10%40psu.edu%7C65b2199d35c84127424208d646dd12c9%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C0%7C636774312669497914&amp;sdata=xQS4VyaVt7WH1k%2FHQCfzcAxDKg9CHcIFvDgYnwyHG7I%3D&amp;reserved=0>
Status: 3 NOTEs
Debian: 
<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwin-builder.r-project.org%2Fincoming_pretest%2FFlexParamCurve_1.5-4_20181110_081104%2FDebian%2F00check.log&amp;data=02%7C01%7Csao10%40psu.edu%7C65b2199d35c84127424208d646dd12c9%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C0%7C636774312669497914&amp;sdata=0EHVRHW1wiBtEXPdhVmEvL4F4Z5ksyOSeHBX8hWTP14%3D&amp;reserved=0>
Status: 1 ERROR, 1 NOTE

Last released version's CRAN status: OK: 2
See: 
<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2FCRAN.R-project.org%2Fweb%2Fchecks%2Fcheck_results_FlexParamCurve.html&amp;data=02%7C01%7Csao10%40psu.edu%7C65b2199d35c84127424208d646dd12c9%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C0%7C636774312669497914&amp;sdata=9bvY8TABo2i7%2FCXGzEsuwt1CXQSo%2Fmr8qMxHZDVjsCg%3D&amp;reserved=0>

CRAN Web: 
<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcran.r-project.org%2Fpackage%3DFlexParamCurve&amp;data=02%7C01%7Csao10%40psu.edu%7C65b2199d35c84127424208d646dd12c9%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C0%7C636774312669497914&amp;sdata=kMDzQTyyQLjyBMTZs%2FUUfVg4HN%2FirDNFFDJ72CIhS4o%3D&amp;reserved=0>

Please fix all problems and resubmit a fixed version via the webform.
If you are not sure how to fix the problems shown, please ask for help on the 
R-package-devel mailing list:
<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-package-devel&amp;data=02%7C01%7Csao10%40psu.edu%7C65b2199d35c84127424208d646dd12c9%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C0%7C636774312669497914&amp;sdata=dAfiX9Nrj3yHPdnB6b%2BloeLUZXHPv9Fx56R9%2Fjjkbik%3D&amp;reserved=0>
If you are fairly certain the rejection is a false positive, please reply-all 
to this message and explain.

More details are given in the directory:
<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwin-builder.r-project.org%2Fincoming_pretest%2FFlexParamCurve_1.5-4_20181110_081104%2F&amp;data=02%7C01%7Csao10%40psu.edu%7C65b2199d35c84127424208d646dd12c9%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C0%7C636774312669497914&amp;sdata=D09NHBYWDGlTpbtADDeUsHcpYDHeWyAOjXVvl67l1UI%3D&amp;reserved=0>
The files will be removed after roughly 7 days.

No strong reverse dependencies to be checked.

Best regards,
CRAN teams' auto-check service
Flavor: r-devel-linux-x86_64-debian-gcc, r-devel-windows-ix86+x86_64
Check: CRAN incoming feasibility, Result: NOTE
  Maintainer: 'Stephen Oswald <steve.osw...@psu.edu>'
  
  New submission
  
  Package was archived on CRAN
  
  CRAN repository db overrides:
    X-CRAN-Comment: Archived on 2018-10-27 as check errors were not
      corrected despite reminder.

Flavor: r-devel-windows-ix86+x86_64
Check: running examples for arch 'i386', Result: NOTE
  Examples with CPU or elapsed time > 10s
                    user system elapsed
  SSposnegRichards 10.79   0.03   10.86

Flavor: r-devel-windows-ix86+x86_64
Check: running examples for arch 'x64', Result: NOTE
  Examples with CPU or elapsed time > 10s
                    user system elapsed
  SSposnegRichards 12.92   0.04   12.98

Flavor: r-devel-linux-x86_64-debian-gcc
Check: examples, Result: ERROR
  Running examples in 'FlexParamCurve-Ex.R' failed
  The error most likely occurred in:
  
  > base::assign(".ptime", proc.time(), pos = "CheckExEnv")
  > ### Name: get.mod
  > ### Title: Copy objects between R environments
  > ### Aliases: get.mod
  > 
  > ### ** Examples
  > 
  > 
  > 
  >  #transfer all nlsList models from the FlexParamCurve working environmment 
(FPCEnv) 
  > 
  > 
  >    #to the Global Environment. Note: unless pn.mod.compare or 
  > 
  > 
  >    #pn.modselect.step have been run, in which case this is default
  > 
  > 
  >    #1. subset data object (only 3 individuals) to expediate model selection
  > 
  > 
  >    subdata <- subset(posneg.data, as.numeric(row.names (posneg.data) ) < 40)
  > 
  > 
  >    #2. run model selection in FPCEnv using pn.mod.compare. Only two models 
(#1 and #5)
  > 
  > 
  >    #specified to be run here to reduce processing time. see pn.mod.compare
  > 
  > 
  >    modseltable <- pn.mod.compare(subdata$age, subdata$mass,
  + 
  + 
  +    subdata$id, existing = FALSE, pn.options = "myoptions", mod.subset = 
c(1,5)
  + 
  + 
  +    , Envir = FlexParamCurve:::FPCEnv)
  [1] modpar will attempt to parameterize your data using the following 
sequential procedures:
  [1]   (1) Extract parameter estimates for 8-parameter double-Richards curve 
in nls
  [1]   (2) Use getInitial to retrieve parameter estimates for 8-parameter 
double-Richards curve
  [1]   (3) Extract parameter estimates for 4-parameter Richards curve in 
  [1]   (4) Use getInitial to retrieve parameter estimates for 4-parameter 
Richards curve
  [1] if any approaches are successful, modpar will return these and terminate 
at that stage
  [1]  
  [1] (1) Status of 8-parameter double-Richards curve fit in nls:
  [1] ....8 parameter nls fit failed
  [1] (2) Status of 8-parameter double-Richards getInitial call
  [1] ....8-parameter getInitial successful
  [1] "checking fit of positive section of the curve for variable 
M*************************************"
  [1] "checking fit of positive section of the curve for fixed 
M*************************************"
  [1] "3 parameter positive richards model failed/not 
fitted*************************************"
  [1] "4 parameter positive richards model failed/not 
fitted*************************************"
  [1] "Variable M models most appropriate*************************************"
  [1] "################  ################  ##################  
#################  ###############  #########"
  [1] "Fitting model 1 of 2: richardsR1.lis"
  [[1]]
  [1] "**********************  Model richardsR1.lis has not been successfully 
fit, please trouble-shoot this model separately and then repeat function using 
existing=TRUE  *************************************************"
  
  [1] "################  ################  ##################  
#################  ###############  #########"
  [1] "Fitting model 2 of 2: richardsR5.lis"
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  FlexParamCurve
   --- call from context --- 
  fn(par, ...)
   --- call from argument --- 
  if (Re(as.complex(1 + M[1] * exp(-K[1] * (xy$x - Infl[1])))) < 
      0) {
      if (Re(as.complex(1 + RM[1] * exp(-Rk[1] * (xy$x - Ri[1])))) < 
          0) {
          if (modno >= 17 & modno < 18) {
              y1 <- SSposnegRichardsF17(xy$x, Asym, Infl, M, RAsym, 
                  Ri, RM)
              y1[is.na(y1)] <- 1e-290 * pnmodelparams$RAsym
              y1[y1 == Inf] <- 1e-290 * pnmodelparams$RAsym
              evl <- sum((xy$y - y1)^2)
              if (!is.na(evl)) {
                  if (evl == Inf) {
                    evl <- 1e+290
                  }
                  else {
                    evl <- 1e+290
                  }
              }
              try(if (min(Im(SSposnegRichardsF17((0:max(xy$x)), 
                  Asym, Infl, M, RAsym, Ri, RM)) < 0)) {
                  evl <- 1e+200
              }, silent = TRUE)
          }
          else {
              y1 <- SSposnegRichardsFMRM(xy$x, Asym, K, Infl, M, 
                  RAsym, Rk, Ri, RM)
              y1[is.na(y1)] <- 1e-290 * pnmodelparams$RAsym
              y1[y1 == Inf] <- 1e-290 * pnmodelparams$RAsym
              evl <- sum((xy$y - y1)^2)
              if (!is.na(evl)) {
                  if (evl == Inf) {
                    evl <- 1e+290
                  }
                  else {
                    evl <- 1e+290
                  }
              }
              try(if (min(Im(SSposnegRichardsFMRM((0:max(xy$x)), 
                  Asym, K, Infl, M, RAsym, Rk, Ri, RM)) < 0)) {
                  evl <- 1e+200
              }, silent = TRUE)
          }
      }
      else {
          if (modno >= 17 & modno < 18) {
              y1 <- SSposnegRichardsF17(xy$x, Asym, Infl, M, RAsym, 
                  Ri, RM)
              y1[is.na(y1)] <- 1e-290 * pnmodelparams$RAsym
              y1[y1 == Inf] <- 1e-290 * pnmodelparams$RAsym
              evl <- sum((xy$y - y1)^2)
              if (!is.na(evl)) {
                  if (evl == Inf) {
                    evl <- 1e+290
                  }
                  else {
                    evl <- 1e+290
                  }
              }
              try(if (min(Im(SSposnegRichardsF17((0:max(xy$x)), 
                  Asym, Infl, M, RAsym, Ri, RM)) < 0)) {
                  evl <- 1e+200
              }, silent = TRUE)
          }
          else {
              y1 <- SSposnegRichardsFM(xy$x, Asym, K, Infl, M, 
                  RAsym, Rk, Ri, RM)
              y1[is.na(y1)] <- 1e-290 * pnmodelparams$RAsym
              y1[y1 == Inf] <- 1e-290 * pnmodelparams$RAsym
              evl <- sum((xy$y - y1)^2)
              if (!is.na(evl)) {
                  if (evl == Inf) {
                    evl <- 1e+290
                  }
                  else {
                    evl <- 1e+290
                  }
              }
              try(if (min(Im(SSposnegRichardsFM((0:max(xy$x)), 
                  Asym, K, Infl, M, RAsym, Rk, Ri, RM)) < 0)) {
                  evl <- 1e+200
              }, silent = TRUE)
          }
      }
  } else {
      if (Re(as.complex(1 + RM[1] * exp(-Rk[1] * (xy$x - Ri[1])))) < 
          0) {
          if (modno >= 17 & modno < 18) {
              y1 <- SSposnegRichardsF17(xy$x, Asym, Infl, M, RAsym, 
                  Ri, RM)
              y1[is.na(y1)] <- 1e-290 * pnmodelparams$RAsym
              y1[y1 == Inf] <- 1e-290 * pnmodelparams$RAsym
              evl <- sum((xy$y - y1)^2)
              if (!is.na(evl)) {
                  if (evl == Inf) {
                    evl <- 1e+290
                  }
                  else {
                    evl <- 1e+290
                  }
              }
              try(if (min(Im(SSposnegRichardsF17((0:max(xy$x)), 
                  Asym, Infl, M, RAsym, Ri, RM)) < 0)) {
                  evl <- 1e+200
              }, silent = TRUE)
          }
          else {
              y1 <- SSposnegRichardsFRM(xy$x, Asym, K, Infl, M, 
                  RAsym, Rk, Ri, RM)
              y1[is.na(y1)] <- 1e-290 * pnmodelparams$RAsym
              y1[y1 == Inf] <- 1e-290 * pnmodelparams$RAsym
              evl <- sum((xy$y - y1)^2)
              if (!is.na(evl)) {
                  if (evl == Inf) {
                    evl <- 1e+290
                  }
                  else {
                    evl <- 1e+290
                  }
              }
              try(if (min(Im(SSposnegRichardsFRM((0:max(xy$x)), 
                  Asym, K, Infl, M, RAsym, Rk, Ri, RM)) < 0)) {
                  evl <- 1e+200
              }, silent = TRUE)
          }
      }
      else {
          if (modno >= 17 & modno < 18) {
              y1 <- SSposnegRichardsF17(xy$x, Asym, Infl, M, RAsym, 
                  Ri, RM)
              y1[is.na(y1)] <- 1e-290 * pnmodelparams$RAsym
              y1[y1 == Inf] <- 1e-290 * pnmodelparams$RAsym
              evl <- sum((xy$y - y1)^2)
              if (!is.na(evl)) {
                  if (evl == Inf) {
                    evl <- 1e+290
                  }
                  else {
                    evl <- 1e+290
                  }
              }
              try(if (min(Im(SSposnegRichardsF17((0:max(xy$x)), 
                  Asym, Infl, M, RAsym, Ri, RM)) < 0)) {
                  evl <- 1e+200
              }, silent = TRUE)
          }
          else {
              y1 <- SSposnegRichardsF(xy$x, Asym, K, Infl, M, RAsym, 
                  Rk, Ri, RM)
              y1[is.na(y1)] <- 1e-290 * pnmodelparams$RAsym
              y1[y1 == Inf] <- 1e-290 * pnmodelparams$RAsym
              evl <- sum((xy$y - y1)^2)
              if (!is.na(evl)) {
                  if (evl == Inf) {
                    evl <- 1e+290
                  }
                  else {
                    evl <- 1e+290
                  }
              }
              try(if (min(Im(SSposnegRichardsF((0:max(xy$x)), Asym, 
                  K, Infl, M, RAsym, Rk, Ri, RM)) < 0)) {
                  evl <- 1e+200
              }, silent = TRUE)
          }
      }
  }
   --- R stacktrace ---
  where 1: fn(par, ...)
  where 2: (function (par) 
  fn(par, ...))(c(Asym = 4334.17580073736, K = 0.0632653544876502, 
  Infl = 24.8483463411178, M = 0.517002166128575, RM = 0.997841195933385
  ))
  where 3: optim(value, richardsR, method = "L-BFGS-B", lower = dnbnds, 
      upper = upbnds, control = list(maxit = 1000, parscale = parscaleR))
  where 4: doTryCatch(return(expr), name, parentenv, handler)
  where 5: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 6: tryCatchList(expr, classes, parentenv, handlers)
  where 7: tryCatch(expr, error = function(e) {
      call <- conditionCall(e)
      if (!is.null(call)) {
          if (identical(call[[1L]], quote(doTryCatch))) 
              call <- sys.call(-4L)
          dcall <- deparse(call)[1L]
          prefix <- paste("Error in", dcall, ": ")
          LONG <- 75L
          sm <- strsplit(conditionMessage(e), "\n")[[1L]]
          w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")
          if (is.na(w)) 
              w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], 
                  type = "b")
          if (w > LONG) 
              prefix <- paste0(prefix, "\n  ")
      }
      else prefix <- "Error : "
      msg <- paste0(prefix, conditionMessage(e), "\n")
      .Internal(seterrmessage(msg[1L]))
      if (!silent && isTRUE(getOption("show.error.messages"))) {
          cat(msg, file = outFile)
          .Internal(printDeferredWarnings())
      }
      invisible(structure(msg, class = "try-error", condition = e))
  })
  where 8: try(oppar1 <- (optim(value, richardsR, method = "L-BFGS-B", lower = 
dnbnds, 
      upper = upbnds, control = list(maxit = 1000, parscale = parscaleR))), 
      silent = TRUE)
  where 9: (attr(object, "initial"))(mCall = mCall, data = data, LHS = LHS)
  where 10: getInitial.selfStart(func, data, mCall = as.list(match.call(func, 
      call = object[[3L]])), LHS = object[[2L]], ...)
  where 11: getInitial(func, data, mCall = as.list(match.call(func, call = 
object[[3L]])), 
      LHS = object[[2L]], ...)
  where 12: getInitial.formula(formula, mf)
  where 13: getInitial(formula, mf)
  where 14: nls(model, data = data, control = controlvals)
  where 15: doTryCatch(return(expr), name, parentenv, handler)
  where 16: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 17: tryCatchList(expr, classes, parentenv, handlers)
  where 18: tryCatch({
      data <- as.data.frame(dat)
      if (is.null(start)) {
          nls(model, data = data, control = controlvals)
      }
      else {
          nls(model, data = data, control = controlvals, start = start)
      }
  }, error = function(e) e)
  where 19: FUN(X[[i]], ...)
  where 20: lapply(split(data, groups), function(dat) tryCatch({
      data <- as.data.frame(dat)
      if (is.null(start)) {
          nls(model, data = data, control = controlvals)
      }
      else {
          nls(model, data = data, control = controlvals, start = start)
      }
  }, error = function(e) e))
  where 21: nlsList.formula(y ~ SSposnegRichards(x, Asym = Asym, K = K, Infl = 
Infl, 
      M = M, RM = RM, modno = 5, pn.options = "myoptions"), data = userdata, 
      ...)
  where 22: nlsList(y ~ SSposnegRichards(x, Asym = Asym, K = K, Infl = Infl, 
      M = M, RM = RM, modno = 5, pn.options = "myoptions"), data = userdata, 
      ...)
  where 23: eval(parse(text = sprintf("%s", 
paste("nlsList(y~SSposnegRichards(x,Asym=Asym", 
      savK, ",Infl=Infl", savM, ",RM=RM,modno=", modelno, ", pn.options = \"", 
      pnoptnm, "\"),data=userdata, ...)", sep = ""))))
  where 24: eval(parse(text = sprintf("%s", 
paste("nlsList(y~SSposnegRichards(x,Asym=Asym", 
      savK, ",Infl=Infl", savM, ",RM=RM,modno=", modelno, ", pn.options = \"", 
      pnoptnm, "\"),data=userdata, ...)", sep = ""))))
  where 25: doTryCatch(return(expr), name, parentenv, handler)
  where 26: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 27: tryCatchList(expr, classes, parentenv, handlers)
  where 28: tryCatch(expr, error = function(e) {
      call <- conditionCall(e)
      if (!is.null(call)) {
          if (identical(call[[1L]], quote(doTryCatch))) 
              call <- sys.call(-4L)
          dcall <- deparse(call)[1L]
          prefix <- paste("Error in", dcall, ": ")
          LONG <- 75L
          sm <- strsplit(conditionMessage(e), "\n")[[1L]]
          w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")
          if (is.na(w)) 
              w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], 
                  type = "b")
          if (w > LONG) 
              prefix <- paste0(prefix, "\n  ")
      }
      else prefix <- "Error : "
      msg <- paste0(prefix, conditionMessage(e), "\n")
      .Internal(seterrmessage(msg[1L]))
      if (!silent && isTRUE(getOption("show.error.messages"))) {
          cat(msg, file = outFile)
          .Internal(printDeferredWarnings())
      }
      invisible(structure(msg, class = "try-error", condition = e))
  })
  where 29: try(eval(parse(text = sprintf("%s", 
paste("nlsList(y~SSposnegRichards(x,Asym=Asym", 
      savK, ",Infl=Infl", savM, ",RM=RM,modno=", modelno, ", pn.options = \"", 
      pnoptnm, "\"),data=userdata, ...)", sep = "")))), silent = TRUE)
  where 30: runmod(userdata, modno[i], modelsig, existing = existing)
  where 31: pn.mod.compare(subdata$age, subdata$mass, subdata$id, existing = 
FALSE, 
      pn.options = "myoptions", mod.subset = c(1, 5), Envir = 
FlexParamCurve:::FPCEnv)
  
   --- value of length: 13 type: logical ---
   [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
  [13] FALSE
   --- function from context --- 
  function (Rparams) 
  {
      val2 <- data.frame(Asym = modelparams$Asym, K = modelparams$K, 
          Infl = modelparams$Infl, M = modelparams$M, RAsym = 
modelparams$RAsym, 
          Rk = modelparams$Rk, Ri = modelparams$Ri, RM = modelparams$RM)
      val3 <- (data.frame(t(Rparams)))
      if (length(val3$Asym) == 1) 
          val2$Asym <- val3$Asym
      if (length(val3$K) == 1) 
          val2$K <- val3$K
      if (length(val3$Infl) == 1) 
          val2$Infl <- val3$Infl
      if (length(val3$M) == 1) 
          val2$M <- val3$M
      if (length(val3$RAsym) == 1) 
          val2$RAsym <- val3$RAsym
      if (length(val3$Rk) == 1) 
          val2$Rk <- val3$Rk
      if (length(val3$Ri) == 1) 
          val2$Ri <- val3$Ri
      if (length(val3$RM) == 1) 
          val2$RM <- val3$RM
      Asym <- val2$Asym
      K <- val2$K
      Infl <- val2$Infl
      M <- val2$M
      RAsym <- val2$RAsym
      Rk <- val2$Rk
      Ri <- val2$Ri
      RM <- val2$RM
      if (is.na(exp(-K * (min(xy$x) - Infl))) == TRUE | (exp(-K * 
          (min(xy$x) - Infl))) == Inf) {
          K = modelparams$K
          Infl = modelparams$Infl
      }
      if (is.na(exp(-K * (max(xy$x) - Infl))) == TRUE | (exp(-K * 
          (min(xy$x) - Infl))) == Inf) {
          K = modelparams$K
          Infl = modelparams$Infl
      }
      if (is.na(exp(-Rk * (min(xy$x) - Ri))) == TRUE | (exp(-Rk * 
          (min(xy$x) - Ri))) == Inf) {
          Rk = modelparams$Rk
          Ri = modelparams$Ri
      }
      if (is.na(exp(-Rk * (max(xy$x) - Ri))) == TRUE | (exp(-Rk * 
          (min(xy$x) - Ri))) == Inf) {
          Rk = modelparams$Rk
          Ri = modelparams$Ri
      }
      options(warn = -1)
      if (modno == 17.2 | modno == 17.4) 
          RAsym <- Asym
      if (modno == 17.3 | modno == 17.4) 
          RM <- M
      if (Re(as.complex(1 + M[1] * exp(-K[1] * (xy$x - Infl[1])))) < 
          0) {
          if (Re(as.complex(1 + RM[1] * exp(-Rk[1] * (xy$x - Ri[1])))) < 
              0) {
              if (modno >= 17 & modno < 18) {
                  y1 <- SSposnegRichardsF17(xy$x, Asym, Infl, M, 
                    RAsym, Ri, RM)
                  y1[is.na(y1)] <- 1e-290 * pnmodelparams$RAsym
                  y1[y1 == Inf] <- 1e-290 * pnmodelparams$RAsym
                  evl <- sum((xy$y - y1)^2)
                  if (!is.na(evl)) {
                    if (evl == Inf) {
                      evl <- 1e+290
                    }
                    else {
                      evl <- 1e+290
                    }
                  }
                  try(if (min(Im(SSposnegRichardsF17((0:max(xy$x)), 
                    Asym, Infl, M, RAsym, Ri, RM)) < 0)) {
                    evl <- 1e+200
                  }, silent = TRUE)
              }
              else {
                  y1 <- SSposnegRichardsFMRM(xy$x, Asym, K, Infl, 
                    M, RAsym, Rk, Ri, RM)
                  y1[is.na(y1)] <- 1e-290 * pnmodelparams$RAsym
                  y1[y1 == Inf] <- 1e-290 * pnmodelparams$RAsym
                  evl <- sum((xy$y - y1)^2)
                  if (!is.na(evl)) {
                    if (evl == Inf) {
                      evl <- 1e+290
                    }
                    else {
                      evl <- 1e+290
                    }
                  }
                  try(if (min(Im(SSposnegRichardsFMRM((0:max(xy$x)), 
                    Asym, K, Infl, M, RAsym, Rk, Ri, RM)) < 0)) {
                    evl <- 1e+200
                  }, silent = TRUE)
              }
          }
          else {
              if (modno >= 17 & modno < 18) {
                  y1 <- SSposnegRichardsF17(xy$x, Asym, Infl, M, 
                    RAsym, Ri, RM)
                  y1[is.na(y1)] <- 1e-290 * pnmodelparams$RAsym
                  y1[y1 == Inf] <- 1e-290 * pnmodelparams$RAsym
                  evl <- sum((xy$y - y1)^2)
                  if (!is.na(evl)) {
                    if (evl == Inf) {
                      evl <- 1e+290
                    }
                    else {
                      evl <- 1e+290
                    }
                  }
                  try(if (min(Im(SSposnegRichardsF17((0:max(xy$x)), 
                    Asym, Infl, M, RAsym, Ri, RM)) < 0)) {
                    evl <- 1e+200
                  }, silent = TRUE)
              }
              else {
                  y1 <- SSposnegRichardsFM(xy$x, Asym, K, Infl, 
                    M, RAsym, Rk, Ri, RM)
                  y1[is.na(y1)] <- 1e-290 * pnmodelparams$RAsym
                  y1[y1 == Inf] <- 1e-290 * pnmodelparams$RAsym
                  evl <- sum((xy$y - y1)^2)
                  if (!is.na(evl)) {
                    if (evl == Inf) {
                      evl <- 1e+290
                    }
                    else {
                      evl <- 1e+290
                    }
                  }
                  try(if (min(Im(SSposnegRichardsFM((0:max(xy$x)), 
                    Asym, K, Infl, M, RAsym, Rk, Ri, RM)) < 0)) {
                    evl <- 1e+200
                  }, silent = TRUE)
              }
          }
      }
      else {
          if (Re(as.complex(1 + RM[1] * exp(-Rk[1] * (xy$x - Ri[1])))) < 
              0) {
              if (modno >= 17 & modno < 18) {
                  y1 <- SSposnegRichardsF17(xy$x, Asym, Infl, M, 
                    RAsym, Ri, RM)
                  y1[is.na(y1)] <- 1e-290 * pnmodelparams$RAsym
                  y1[y1 == Inf] <- 1e-290 * pnmodelparams$RAsym
                  evl <- sum((xy$y - y1)^2)
                  if (!is.na(evl)) {
                    if (evl == Inf) {
                      evl <- 1e+290
                    }
                    else {
                      evl <- 1e+290
                    }
                  }
                  try(if (min(Im(SSposnegRichardsF17((0:max(xy$x)), 
                    Asym, Infl, M, RAsym, Ri, RM)) < 0)) {
                    evl <- 1e+200
                  }, silent = TRUE)
              }
              else {
                  y1 <- SSposnegRichardsFRM(xy$x, Asym, K, Infl, 
                    M, RAsym, Rk, Ri, RM)
                  y1[is.na(y1)] <- 1e-290 * pnmodelparams$RAsym
                  y1[y1 == Inf] <- 1e-290 * pnmodelparams$RAsym
                  evl <- sum((xy$y - y1)^2)
                  if (!is.na(evl)) {
                    if (evl == Inf) {
                      evl <- 1e+290
                    }
                    else {
                      evl <- 1e+290
                    }
                  }
                  try(if (min(Im(SSposnegRichardsFRM((0:max(xy$x)), 
                    Asym, K, Infl, M, RAsym, Rk, Ri, RM)) < 0)) {
                    evl <- 1e+200
                  }, silent = TRUE)
              }
          }
          else {
              if (modno >= 17 & modno < 18) {
                  y1 <- SSposnegRichardsF17(xy$x, Asym, Infl, M, 
                    RAsym, Ri, RM)
                  y1[is.na(y1)] <- 1e-290 * pnmodelparams$RAsym
                  y1[y1 == Inf] <- 1e-290 * pnmodelparams$RAsym
                  evl <- sum((xy$y - y1)^2)
                  if (!is.na(evl)) {
                    if (evl == Inf) {
                      evl <- 1e+290
                    }
                    else {
                      evl <- 1e+290
                    }
                  }
                  try(if (min(Im(SSposnegRichardsF17((0:max(xy$x)), 
                    Asym, Infl, M, RAsym, Ri, RM)) < 0)) {
                    evl <- 1e+200
                  }, silent = TRUE)
              }
              else {
                  y1 <- SSposnegRichardsF(xy$x, Asym, K, Infl, 
                    M, RAsym, Rk, Ri, RM)
                  y1[is.na(y1)] <- 1e-290 * pnmodelparams$RAsym
                  y1[y1 == Inf] <- 1e-290 * pnmodelparams$RAsym
                  evl <- sum((xy$y - y1)^2)
                  if (!is.na(evl)) {
                    if (evl == Inf) {
                      evl <- 1e+290
                    }
                    else {
                      evl <- 1e+290
                    }
                  }
                  try(if (min(Im(SSposnegRichardsF((0:max(xy$x)), 
                    Asym, K, Infl, M, RAsym, Rk, Ri, RM)) < 0)) {
                    evl <- 1e+200
                  }, silent = TRUE)
              }
          }
      }
      if (!is.na(evl)) {
          if (evl == Inf) {
              evl <- 1e+290
          }
          else {
              evl <- 1e+290
          }
      }
      options(warn = 0)
      return(evl)
  }
  <bytecode: 0x7f5e23270b20>
  <environment: 0x7f5e21d96b40>
   --- function search by body ---
   ----------- END OF FAILURE REPORT -------------- 
  Fatal error: the condition has length > 1
______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Reply via email to