[Rd] package.skeleton() in R-2.4.1

Robin Hankin r.hankin at noc.soton.ac.uk
Tue Sep 12 09:26:58 CEST 2006


Hi

R version 2.4.0 alpha (2006-09-06 r39158)
MacOSX 10.4.7


There was a thread some time ago as to whether  the structure created by
package.skeleton() would pass R CMD check.

I have an example where package.skeleton() gives an R file that gives an
error when sourced.


If I type

setClass("brob",
          representation = representation 
(x="numeric",positive="logical"),
          prototype      = list(x=numeric(),positive=logical())
          )

setGeneric("getX",function(x){standardGeneric("getX")})
setMethod("getX","brob",function(x){x at x})


(which is legal, AFAICS), then

package.skeleton(path="~")

I get a file ~/anRpackage/R/getX.R containing:


"getX" <-
structure(function(x){standardGeneric("getX")}
, generic = structure("getX", package = ".GlobalEnv"), package =  
".GlobalEnv", group = list(), valueClass = character(0), signature =  
"x", default = <S4
object of class structure("MethodsList", package = "methods")>,  
skeleton = quote(function (x)
stop("invalid call in method dispatch to 'getX' (no default method)",
     domain = NA)(x)), class = structure 
("nonstandardGenericFunction", package = "methods"))


[subject to line breaking] but this file gives an error when
sourced (below).   I didn't get this problem with R-2.3.1.


 > > source("/Users/rksh/anRpackage/R/getX.R")
Error in parse(file, n = -1, NULL, "?") : syntax error at
2: structure(function(x){standardGeneric("getX")}
3: , generic = structure("getX", package = ".GlobalEnv"), package =  
".GlobalEnv", group = list(), valueClass = character(0), signature =  
"x", default = <
 >



Am I doing something wrong?



--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
  tel  023-8059-7743




More information about the R-devel mailing list