-
Notifications
You must be signed in to change notification settings - Fork 0
Repository Setup
Once you have completed the workstation setup, you are ready to setup a project or join in on an existing project.
In RStudio, in the top left select File -> New Project or in the top right select Project: (None) -> New Project. A New Project window should appear giving three options to set up a project. Select Version Control then select Git.
For Repository URL: paste in the project's Git website (ex. https://github.com/centerforpeaceandsecuritystudies/MSSLStyleGuide). The Project directory name: will automatically fill in with the repository name (in example's case, "MSSLStyleGuide"). For Create project as subdirectory of:, create the folder "github_private" in your dropbox folder and select that (so entry may become "~/Dropbox/github_private"). This will be important for accessing data saved elsewhere in Dropbox.
Once you create the directory for an existing repository, it will automatically pull the existing files. From now on you will manually have to commit and push files (in that order) to add your work to the repository and pull files to stay up to date with other team members' contributions. All of these commands can be done from the git tab in the top-right pane of RStudio.
If the repository has already been set-up, then you're ready to go. If you are setting it up yourself, see the next section.
In most cases you will be joining a package that is already setup, so after you pull all the folders and files will already be organized for you.
-
Create the repository on the github website. Be sure to mark it private.
-
Open RStudio and create a project directory as described above.
-
With the project open in RStudio, run the following. On the last command you will be asked if you want to overwrite the existing package; answer no.
install.packages("devtools")
devtools::install_github("r-lib/usethis")
library(usethis)
create_package(getwd())
- Run the rest of this code. If it asks if you want to overwrite, you can say yes.
Note that one command may say that it cannot find the file DESCRIPTION. If you open DESCRIPTION from RStudio, that line should then work.
devtools::install_github("r-lib/callr")
install.packages("testthat")
library(usethis)
use_mit_license("My Name")
use_package("MASS", "Suggests")
use_roxygen_md()
use_rcpp()
use_revdep()
use_readme_md()
use_news_md()
use_test("my-test")
x <- 1
y <- 2
use_data(x, y)
dir.create(file.path(getwd(), "docs"))
dir.create(file.path(getwd(), "inst"))
dir.create(file.path(paste0(getwd(),"/inst"), "extdata"))
dir.create(file.path(getwd(), "paper"))
dir.create(file.path(paste0(getwd(),"/paper"), "figures"))