[R] Errors while compiling packages with namespace?

Luke Tierney luke at stat.uiowa.edu
Sun Oct 17 16:04:40 CEST 2004


The error message points to line 21 of the NAMESPACE file:

S3method(view, function)

The NAMESPACE file is parsed by the R parser, so this is a suntax
error since function is a reserved word.  Put quotes around it and you
should be OK.

luke

On Sun, 17 Oct 2004, Philippe Grosjean wrote:

> Hello,
>
> I try to set up namespaces for packages. It is fine for several of them,
> except one whose compilation fails (under Windows XP & R 2.0.0):
>
> ---------- Making package svViews ------------
>  adding build stamp to DESCRIPTION
>  installing NAMESPACE file and metadata
> Error in parse(file, n, text, prompt) : syntax error on line 21
> Execution halted
> make[2]: *** [nmspace] Error 1
> make[1]: *** [all] Error 2
> make: *** [pkg-svViews] Error 2
> *** Installation of svViews failed ***
>
> This kind of error tells me that there is something wrong in my code, making
> it impossible to parse, isn't it? However, when I source the code in R,
> everything is fine. Also, this package compiled without errors before I
> introduced NAMESPACE. The only changes I did in the code (beside adding
> NAMESPACE), is to eliminate all "require(....)" and to replace them by
> "import" and "importFrom" statements in NAMESPACE. So, I suppose this should
> be due to a wrong or missing "import", or "importFrom" directive. Does
> anybody has another suggestion?
>
> My question is: how do I know where is the error in my code, given this
> message: "syntax error in line 21" while installing NAMESPACE. Obviously, it
> is not in "line 21" of any of my original code files in ./R (because I can
> source them all without error). At this point, I am completelly lost. Any
> help would be welcome. This package contains several hundreds of lines of
> code, and NAMESPACE is quite complex:
>
> importFrom(svMisc, listCustoms, getTemp)
> importFrom(R2HTML, HTML, HTMLhr, HTMLInsertGraph, HTMLli, HTML.cormat)
> importFrom(utils, browseURL, methods)
> importFrom(lattice, lset)
> importFrom(MASS, lda)
>
> import(svIO, graphics, grDevices, stats)
>
> export(guiViewsCmd,
>       guiViewsCSS,
>       guiViewsCSSChange,
>       guiViewsDir,
>       guiViewsDisplay,
>       guiViewsFile,
>       report,
>       reportGraph,
>       viewHTMLinit)
>
> S3method(view, default)
> S3method(view, data.frame)
> S3method(view, function)
> S3method(view, matrix)
> S3method(view, princomp)
> S3method(view, trellis)
> S3method(view, ts)
>
> Thank you.
> Best,
>
> Philippe Grosjean
>
> ..............................................<°}))><........
> ) ) ) ) )
> ( ( ( ( (    Prof. Philippe Grosjean
> ) ) ) ) )
> ( ( ( ( (    Numerical Ecology of Aquatic Systems
> ) ) ) ) )   Mons-Hainaut University, Pentagone
> ( ( ( ( (    Academie Universitaire Wallonie-Bruxelles
> ) ) ) ) )   6, av du Champ de Mars, 7000 Mons, Belgium
> ( ( ( ( (
> ) ) ) ) )   phone: + 32.65.37.34.97, fax: + 32.65.37.33.12
> ( ( ( ( (    email: Philippe.Grosjean at umh.ac.be
> ) ) ) ) )
> ( ( ( ( (    web:   http://www.umh.ac.be/~econum
> ) ) ) ) )
> ..............................................................
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

-- 
Luke Tierney
University of Iowa                  Phone:             319-335-3386
Department of Statistics and        Fax:               319-335-3017
    Actuarial Science
241 Schaeffer Hall                  email:      luke at stat.uiowa.edu
Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu


More information about the R-help mailing list