简体   繁体   中英

How to build a package in an existing directory with RStudio

I am working on a making a package in RStudio. I already have it as a project, and I am using Git for version control. My directory structure is currently

--Project
   --R
   --.git

With the R code in the R directory.

My problem occurs when I go to build the package. I want to call the package "Project" and I get the a directory structure like this:

--Project
   --R
   --.git
   --Project
      --man
      --R

And in this setup there are two sets of R files, on in each "R" directory. The less nested one is being versioned by Git, the more nested one is the source for the package. Is there some way to get the package to just use the preexisting "R" directory? Can I just reanme my current "Project" directory to something else, make the package as "Project" and then copy the .git directory to the new Project directory?

In RStudio (I'm using v. 1.0.136), this can be done via the menu options Tools > Project Options > Build Tools . Select Package from the drop-down list for Project build tools , and if you know what you're doing, fill in any of the other fields as you deem appropriate.

This operation is not going to necessarily give you the structure above ie man and R folders or a DESCRIPTION file, which can be done with the use_description() function from the usethis package.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM