-
Notifications
You must be signed in to change notification settings - Fork 3
Home
The steps below describe how you set up your local development environment in to order to continue developing the trendminer
R package:
-
Start with installing R, RStudio and Git on your machine
-
Launch R Studio and install the following R packages via the console:
-
devtools
: makes development easier by providing R functions that simplify common tasks -
remotes
: Downloads and installs R packages stored in 'GitHub', 'BitBucket'
-
install.packages(c("devtools", "remotes"))
- Next, we need to install the remaining packages the
trendminer
package depends on AND packages which are needed for the developing itself like, e.g.,testthat
for creating unit tests. Just execute the following three commands in the console:
# Corresponds to the 'Imports' statement in the package DESCRIPTION
install.packages(c("httr", "jsonlite", "magrittr", "dplyr", "rlang", "lubridate"))
# Corresponds to the 'Suggests' statement in the package DESCRIPTION
install.packages(c("testthat", "spelling", "knitr", "rmarkdown", "covr", "data.tree", "networkD3", "purrr", "ggplot2"))
install.packages("usethis")
- Now, we need to
git clone
thetrendminer
repo from GitHub by executing the the following command (in case you git clone via HTTPS) now outside of your R console:
git clone https://github.com/TrendMiner/trendminer.git
- Before we actually take a look at the development resources we just downloaded, we set the necessary R environment variables. Go ahead and execute the following command in your R console which will let you edit your
.Renviron
file of your home directory:
usethis::edit_r_environ()
- Add the following environment 6 variables to
.Renviron
and save the file. The first 5 variables correspond to those also a standard user of the Rtrendminer
package needs to set.
TM_client_ID = YOUR_CLIENT_ID_HERE
TM_client_secret = YOUR_CLIENT_SECRET_HERE
TM_usr = YOUR_USER_NAME_HERE
TM_pwd = YOUR_USER_PASSWORD_HERE
TM_base_url = YOUR_TM_BASE_URL_HERE
NOT_CRAN = TRUE
-
Close RStudio (new environment variables are only available after a re-launch of the R session)
-
We navigate to the repo folder we cloned from GitHub and click on the
trendminer.Rproj
file which will launch RStudio and the R package project -
Optional: For a quick test to check your setup you could execute the unit tests against the TrendMiner instance you specified in the environment variables above by pressing 'CTRL + SHIFT + T' (Windows) or 'CMD + SHIFT + T' (Mac)
You can now continue developing :-). Have fun!
Vignettes are not part of R packages which are downloaded from GitHub. Based on the fact that trendminer is an API package which relies on specific secrets and a specific test environment, vignettes cannot be built by the user while downloading the package.
In order to make the vignettes available via GitHub downloads, the extra steps below need to be conduced on the development side when you update the vignettes:
One time steps:
- delete
inst/doc
from.gitignore
Re-current procedure after every vignette update:
-
Execute the following commands:
devtools::build_vignettes() dir.create("inst/doc") file.copy("./doc", "./inst", recursive = TRUE)
-
git commit
the new/updated files ininst/doc
-
git push
Shortly before the first CRAN release inst/doc
and its content need to be deleted and the change in .gitignore
should be reverted as well. Those changes should, of course, also be committed.
Publishing to CRAN will ensure that the vignettes will be published as well and we can ensure that they are included in trendminer CRAN package downloads. Downloading dev versions from the master or other branches on GitHub won't come with the vignettes at that point in time anymore but that is by intention.