[R-pkg-devel] A problem with Sweave in developing a package vignette

2017-11-24 Thread Magnus Peterson

I am using Sweave to create a vignette for a package,
but when it appears in a code chunk of the .Rnw file
the following line causes an execution halt of Sweave:-

data("WingPoints",envir = environment(()))

This is surprising since this data call as a line
of a function within the package is accepted  by R
and is indeed part of the "Best practice" recommendations
in ?data called from R.

What Sweave apparently objects to is the first closing
inner bracket, indicating an empty inner argument for
the variable environment.

Is this a bug or what should I do?  The function runs perfectly
in R in its usual context, and in the .Rnw file it is in a  chunk
headed
<=

Magnus Peterson

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Re: [R-pkg-devel] A problem with Sweave in developing a package vignette

2017-11-24 Thread Duncan Murdoch

On 24/11/2017 12:34 PM, Magnus Peterson wrote:

I am using Sweave to create a vignette for a package,
but when it appears in a code chunk of the .Rnw file
the following line causes an execution halt of Sweave:-

data("WingPoints",envir = environment(()))

This is surprising since this data call as a line
of a function within the package is accepted  by R
and is indeed part of the "Best practice" recommendations
in ?data called from R.


That's not legal syntax, so I'm not sure why you think it is accepted by 
R.  I see this when I try to run that:


> data("WingPoints",envir = environment(()))
Error: unexpected ')' in "data("WingPoints",envir = environment(()"



What Sweave apparently objects to is the first closing
inner bracket, indicating an empty inner argument for
the variable environment.


No, since it is not legal syntax, it doesn't indicate anything at all.




Is this a bug or what should I do?  The function runs perfectly
in R in its usual context, and in the .Rnw file it is in a  chunk
headed


It's a bug in your code.  I don't know if this is what you are trying to 
do, but this would be legal syntax:


  data("WingPoints",envir = environment())

Duncan Murdoch

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel