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>"?? Thank you -- View this message in context: http://r.789695.n4.nabble.com/package-skeleton-generates-env-environment-tp3870577p3870577.html Sent from the R help mailing list archive at Nabble.com.
Duncan Murdoch
2011-Oct-04 14:21 UTC
[R] package.skeleton generates ".env = <environment>"
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