This chapter will provide guidance on how to get started. First, we will install and integrate Git. Afterwards, we will add GitHub-Access to RStudio. Lastly, we will clone the repository, add a features in a feature branch, and create a pull-request for merging our features with the master branch. This may sound complicated, but it really isn't.
Tools -> Global Options -> Git/SVN
git.exe
For this, we need to generate a Personal Access Token on GitHub, and add it to the R environment.
# install.packages(usethis)
library(usethis)
# your details
use_git_config(
user.name = "your.username",
user.email = "your@email.com"
)
# get a PAT
create_github_token()
# store PAT in .Renviron
edit_r_environ()
## .Renviron will be opended.
## Manually enter in .Renviron:
## GITHUB_PAT=xxxyyyzzz
## end the file with a newline!
## save and close .Renviron
File -> New Project -> Version Control
Git
project URL
, enter github.com/lmuenter/moody.git
Create project as subdirectory of:
, choose an appropriate location.create project
Our main goal in using Git is to prevent conflicts. It also makes collaboration more democratic. Hence, will not immediately add to the main repository (master branch
). Instead, we will branch-off the repository, edit the new feature branch
, and use a pull request
to ask others if our changes should be added to master
.
Now, we can start working on the actual repository. We will create the markdown-document "hello_world.md" in the directory "dev/examples".
moody.Rproj
by double-clicking. You can find this R-project in the directory you selected in 3.5
Git
next to Environment
, History
and Files
.example
. Now you are not in master
anymore!File -> new file -> Markdown File
## Hello World
Hello World
ctrl + s
). The file explorer will openAdd the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.