The issue here is the incomplete deparsing of S4 objects in pre-2.4.0. I am really not sure you want to make a package this way: rather I would want the setClass etc calls in the package code.
On Tue, 12 Sep 2006, Robin Hankin wrote: > 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)[EMAIL PROTECTED]) > > > (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 > > ______________________________________________ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel