Re: [R] package.skeleton from within function: objects not found

2008-01-29 Thread Tineke Casneuf
Hi all, sorry to bother you all once more, but I still haven't solved this problem. Is there anyone who knows how to pass an environment as an argument to package.skeleton from within function, so that this environment can be saved into a newly build source package? See example script below. Many

Re: [R] package.skeleton from within function: objects not found

2008-01-28 Thread Tineke Casneuf
Professor Ripley, do you have an idea why it works for me to save different types of objects, but not for the environment object I construct in the function: ### Example of a function that works without error: fun2 <- function(myname){ f <- function(x,y) x+y g <- function(x,y) x-y d <- da

Re: [R] package.skeleton from within function: objects not found

2008-01-28 Thread Tineke Casneuf
Indeed, this works. Thanks! On Jan 28, 2008 9:30 AM, Prof Brian Ripley <[EMAIL PROTECTED]> wrote: > You need to set the 'environment' argument (the help file is incomplete). > e.g. > > env <- sys.frames()[[sys.nframe()]] > package.skeleton(name = pkgName, list=c("f","e", "myenv"), env=env) > > >

Re: [R] package.skeleton from within function: objects not found

2008-01-28 Thread Prof Brian Ripley
You need to set the 'environment' argument (the help file is incomplete). e.g. env <- sys.frames()[[sys.nframe()]] package.skeleton(name = pkgName, list=c("f","e", "myenv"), env=env) On Mon, 28 Jan 2008, Tineke Casneuf wrote: > Hi all, > > I ran into a strange error: I am trying to create a pac

[R] package.skeleton from within function: objects not found

2008-01-28 Thread Tineke Casneuf
Hi all, I ran into a strange error: I am trying to create a package skeleton for a new source package from within a function. Objects that are created in this function are to be included in my package, but for some reason, I get an error message saying that these objects cannot be found. Here is