[R] unable to get bigglm working, ATTN: Thomas Lumley

stephenb Stephen.Bond at cibc.com
Fri Jul 2 16:28:36 CEST 2010


I am using an example posted in this help forum to work with a file. the head
of the file looks like:
988887 2007-03-05 2007-06-01 90 3 5.450 205500.00 999.00 999.000 0.000 0 0
988887 2007-03-06 2007-06-01 90 3 5.450 205500.00 999.00 999.000 0.000 1 0
988887 2007-03-07 2007-06-01 90 3 5.450 205500.00 999.00 999.000 -0.100 2 0
988887 2007-03-08 2007-06-01 90 3 5.450 205500.00 999.00 999.000 -0.100 3 0
988887 2007-03-09 2007-06-01 90 3 5.450 205500.00 999.00 999.000 -0.100 4 0
988887 2007-03-12 2007-06-01 90 3 5.450 205500.00 999.00 999.000 -0.100 7 0
988887 2007-03-13 2007-06-01 90 3 5.450 205500.00 999.00 999.000 -0.100 8 0
988887 2007-03-14 2007-06-01 90 3 5.450 205500.00 999.00 999.000 -0.100 9 0
988887 2007-03-15 2007-06-01 90 3 5.450 205500.00 999.00 999.000 -0.100 10 0
988887 2007-03-16 2007-06-01 90 3 5.450 205500.00 999.00 999.000 -0.100 11 0

the code is:
make.data <- function (filename, chunksize, ...) { 
  conn<-NULL; 
  function (reset=FALSE) { 
    if (reset) { 
      if (!is.null(conn)) { 
        close(conn); 
      }; 
      conn <<- file (description=filename, open="r"); 
    } else { 
      rval <- read.table (conn, nrows=chunksize,sep=' ', 
        skip=0, header=FALSE,...); 
      if (nrow(rval)==0) { 
        close(conn); 
        conn<<-NULL; 
        rval<-NULL; 
      } else { 
        rval$relage <- rval$loctime/rval$term; 
        
      }; 
    return(rval); 
    } 
  } 
};

a <- make.data ( filename = "G:/sqldata/newf4.csv", chunksize = 100000, 
  colClasses = list ("NULL", "Date","Date", "integer",
"factor",rep("numeric",5),rep("integer",2)), 
  col.names = c("id","dt", "promdt","term", "termfac",
"commintr","commbal","issuebal","intr","ri","loctime","resp") 
)
library(biglm); 

bigglm (formula = resp ~ poly(relage,2,raw=TRUE)+termfac+ri , 
  data = a, family = binomial(link='logit')); 
###   output:
> bigglm (formula = resp ~ poly(relage,2,raw=TRUE)+termfac+ri , 
+   data = a, family = binomial(link='logit')); 
Error in is(object, Class) : 
  trying to get slot "className" from an object of a basic class ("list")
with no slots
> 

### the following can create a df, so the problem is not loading the data
(maybe :-)
a <- read.table ( "G:/sqldata/newf4.csv", nrows= 500000, sep=' ',head=F,
  colClasses = c("NULL",
"Date","Date","integer","factor",rep("numeric",5),rep("integer",2)),
  col.names = ("id","dt", "promdt","term", "termfac",
"commintr","commbal","issuebal","intr","ri","loctime","resp") 
)

Thanks everybody.
-- 
View this message in context: http://r.789695.n4.nabble.com/unable-to-get-bigglm-working-ATTN-Thomas-Lumley-tp2276524p2276524.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list