Hi all,

I think there's a bug in package.skeleton(), when using the environment
argument:

Example:

env <- new.env()
env$hello  <- function() { print('hello') }
package.skeleton(name='mypkg', environment=env)

==> does not create any source in mypkg/R/*

By the way, package.skeleton(name='mypkg', environment=env, list="hello")
does not work either.

According to the documentation:
>The arguments list, environment, and code_files provide alternative ways
to initialize the package.
> If code_files is supplied, the files so named will be sourced to form the
environment, then used to generate the package skeleton.
>Otherwise list defaults to the non-hidden files in environment (those
whose name does not start with .), but can be supplied to select a subset
of the objects in that environment.

I believe to have found the problem: in package.skeleton() body, the two
calls to dump():
> dump(internalObjs, file = file.path(code_dir, sprintf("%s-internal.R",
name)))
> dump(item, file = file.path(code_dir, sprintf("%s.R", list0[item])))
should use the extra argument: envir=environment

There's also a typo in the doc:
The sentence:
> Otherwise list defaults to the non-hidden **files** in environment (those
whose name does not start with .)
should be
> Otherwise list defaults to the non-hidden **objects** in environment
(those whose name does not start with .)

Best,
Karl Forner



>  sessionInfo()
R version 3.0.1 (2013-05-16)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8          LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8           LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8       LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8          LC_NAME=en_US.UTF-8
 [9] LC_ADDRESS=en_US.UTF-8        LC_TELEPHONE=en_US.UTF-8
[11] LC_MEASUREMENT=en_US.UTF-8    LC_IDENTIFICATION=en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] rj_1.1.3-1

loaded via a namespace (and not attached):
[1] rj.gd_1.1.3-1 tools_3.0.1

        [[alternative HTML version deleted]]

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

Reply via email to