6

I am seeing the error message when trying to plot a gam object in R:

Error in 1:object$nsdf : argument of length 0

I am using the basic command:

plot(myGamObject)

This error is not specific to any data I am using as it also comes up at the end of the routine:

example(gam)

For completeness, here is some sample code:

library(ISLR)
library(gam)
gam7 <- gam(wage~lo(year, span = 2) + s(age, 4) + maritl + education + health_ins + health + jobclass, data = Wage)
plot(gam7)

and here is my system:

   sysname        release        version       nodename 
 "Windows"     ">= 8 x64"   "build 9200" "MEANMACHINE4" 
   machine          login           user effective_user 
  "x86-64"       "Julian"       "Julian"       "Julian" 
julianhatwell
  • 1,074
  • 1
  • 8
  • 17
  • 1
    Don't know if this helps, but `mgcv::vis.gam(gam7)` also gives `Error in vis.gam(gam7) : replacement has length zero`. So I've been looking through both source codes and both seem to rely on parts of the `gam` object that aren't there. So yeah, I think the functions are just broken. I could be wrong, though. – slamballais Feb 29 '16 at 13:30
  • 1
    How strange. There's nothing else that I can find about this after a lot of search. I will try writing to the maintainers of the gam & mgcv packages. – julianhatwell Mar 01 '16 at 07:06
  • What is your `getRversion()` and `packageVersion("gam")`? It ran on R 3.2.4 and gam 1.12. But before I updated R, I was on 3.2.3 and gam 1.12 and got the same error, I was also mucking about with other packages that may have created a conflict. – C8H10N4O2 Mar 31 '16 at 18:02
  • Thanks. I have updated to the latest R and updated all my packages and I've got everything working. – julianhatwell Apr 04 '16 at 04:08

1 Answers1

1

I have updated to the latest R 3.2.4, and updated all my packages and I've got everything working.

julianhatwell
  • 1,074
  • 1
  • 8
  • 17