[R] package.skeleton generates ".env = <environment>"

Duncan Murdoch murdoch.duncan at gmail.com
Tue Oct 4 16:21:10 CEST 2011


On 04/10/2011 6:40 AM, pedabreu wrote:
> Hello,
>
> i trying to create a package using package.skeleton. I use R.oo package to
> create oriented-object classes. When i use package.skeleton, this creates
> the following file:
>
> classA<-
> structure(function()
>             {
>
>               extend(Object(),"Class A",
>                      .var1= NULL)
>
>
>             }
> , .env =<environment>, class = c("Class", "Object"), formals = c("public",
> "class"), modifiers = c("public", "class"))
>
> Then i compile using R CMD build myPkg.
>
> when i try to install.package and give this error:
>
> "  /tmp/RtmpaOZ7IQ/R.INSTALL412da433/JSSbase/R/GTHeuristic.R:7:10:
> unexpected '<'
> 6:            }
> 7: , .env =<"
>
> why the package.skeleton creates ".env =<environment>"??

package.skeleton tries to deparse your code, but in some cases, that 
can't be done.  As ?deparse says, "However, not all objects are 
deparse-able even with this option and a warning will be issued if the 
function recognizes that it is being asked to do the impossible."

What you need to do is to copy your original source code that created 
classA into the package source.  Presumably it uses some functions from 
R.oo to construct the object properly.

Duncan Murdoch



More information about the R-help mailing list