0

I have a matter which I couldn't solve for past couple of days. Which is: I want to trycatch() when logspline is not converging. My part of the code which has to do that looks like this:

tryCatch({
pl1<-logspline(cost_disease,lbound=0,ubound=max(cost_disease), error.action=1)
pl2<-logspline(cost_disease1,lbound=0,ubound=max(cost_disease1), error.action=1)
dev.off()
}, 
error=function(e){cat("Logspline failed!",conditionMessage(e), "\n")})

I mention that I am using R shiny. And i still get this error :

Error in oldlogspline(x, lbound = jlx, ubound = jux) : * no convergence

Thank you!

ilden
  • 19
  • 5
  • Please add `dput(cost_disease1)` and `dput(cost_disease)` to your question. – nrussell Aug 25 '15 at 15:23
  • Where exactly? I have added now the error that I get – ilden Aug 25 '15 at 15:24
  • Anywhere in your question - please take a few minutes to read through [this](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). – nrussell Aug 25 '15 at 15:26
  • After putting dput I get : [1] "simulation" c(0, 4349.24946205504, 4702.17986997217, 0, 0, 0, 0, 0, 4485.31364645809, 0, 0, 0, 0, 0, 0, 0, 0, 4465.72236994654, 0, 4489.17902391404, 4015.13026135415, 3957.88117491826, 4415.88737084717, 0, 0) c(477.103075448424, 0, 0, 230.54889459908, 217.801164692268, 0, 3598.94042426348, 0, 0, 226.023693557829, 3247.3266235739, 0, 0, 239.922602081671, 0, 0, 0, 0, 3171.49456971511, 219.66666730307, 0, 0, 0, 0, 716.303983351216) [1] "simulation" Error in oldlogspline(x, lbound = jlx, ubound = jux) : * no convergence – ilden Aug 25 '15 at 15:31
  • 1
    @ilden he means that we need a sample of your two data sets in order to reproduce your code and errors and edit your question and copy/paste those in – rawr Aug 25 '15 at 15:33
  • @ilden There are multiple examples of how to use `dput` in the post that I linked, and please put the results in your *question*, not in a *comment*, as the former is much more visible. – nrussell Aug 25 '15 at 15:35
  • Thank you and sorry for messy writing! – ilden Aug 25 '15 at 16:19

0 Answers0