[R] package.skeleton warning

carol white wht_crl at yahoo.com
Wed Apr 29 09:49:49 CEST 2015

So I finally used 
filenames <- list.files("~/Desktop/myPkg/R/", full.names = TRUE)
package.skeleton(name = "myPackage", code_files = filenames) 
and still despite the warnings mentioned before, the man and R folders seem to have been created correctly. I had put the vignettes folder and inst in the source folder (~/Desktop/myPkg) at the same level as R folder. inst contains citation. but after invoking package.skeleton, nothing happened to copy the vignettes nor inst folders in the myPackage folder. Should package.skeleton have taken care of them or I should process separately?

     On Tuesday, April 28, 2015 5:22 PM, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:

 On 28/04/2015 11:09 AM, carol white wrote:
> I have many code files so listing them will be long. When leave it
> empty, I get
> package.skeleton(name = "myPackage", code_files = "")
> Error in sys.source(cf, envir = environment) : '' is not an existing file

Sorry, I meant "leave it out", i.e. just use
package.skeleton(name="myPackage").  This will look at the objects that
are currently defined in your workspace and base your package on those.

But if you have your code already in a bunch of files in
~/Desktop/myPkg/R/, you could use

filenames <- list.files("~/Desktop/myPkg/R/", full.names = TRUE)

to get all the names in one vector, and use that as the code_files
argument, i.e.

package.skeleton(name = "myPackage", code_files = filenames)

You may need to leave out some files if they aren't all *.R files.

Duncan Murdoch

> Thanks
> On Tuesday, April 28, 2015 4:48 PM, Duncan Murdoch
> <murdoch.duncan at gmail.com> wrote:
> On 28/04/2015 10:05 AM, carol white via R-help wrote:
>>  Hi,Why do I get this warning when I run package.skeleton() and how to
> solve this problem?
>> Warning messages:
>> 1: In package.skeleton(name = "myPackage", code_files =
> "~/Desktop/myPkg/R/") :
>>    Invalid file name(s) for R code in ./myPackage/R:
>>    'R'
>>  are now renamed to 'z<name>.R'
>> 2: In file.rename(from = file.path(code_dir, wrong), to =
> file.path(code_dir,  :
>>    cannot rename file './myPackage/R/R' to './myPackage/R/zR.R',
> reason 'No such file or directory'
> You are saying that your code is in a file called
> "~/Desktop/myPkg/R/"
> but you have no such file.  If you really do have your code already in
> some files, list them in the code_files argument, otherwise leave it blank.
> Duncan Murdoch

	[[alternative HTML version deleted]]

More information about the R-help mailing list