[R] Error in gam?

Peter Dalgaard p.dalgaard at biostat.ku.dk
Sun Apr 18 23:18:28 CEST 2004

Hadley Wickham <h.wickham at auckland.ac.nz> writes:

> I'm having some problems using variable names containing spaces (using
> backticks) with gam (mgcv 0.9-6, R 1.8.1).  Some toy code to reproduce
> my problem is below.  Am I doing something wrong, or should I pass
> this bug on to Simon Wood? (Or do I need to rename my variables to get
> rid of the spaces?)

It's a problem of a sort that we've seen with several kinds of
modeling code.

Basically, the code appears to be using a deparse-paste-parse
technique and gets the backtick bit wrong. Probably, we should start
an effort to get things done right within base R first and only then
pester Simon and others.  In particular, I suspect we should supply a
replacement for the parse(paste("~", paste(terms, collapse="+")))
construction that doesn't have to go via the textual representation.

For now, I think you might want to rename variables and begone with

   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907

More information about the R-help mailing list