DEV-README.md

sos4R developer documentation

Build Status AppVeyor build status

This file contains information for developers of the R package sos4R. Documentation for users can be found in the package's vignettes (see browseVignettes("sos4R")).

sos4R is developed on GitHub using the fork & pull development model. The main repository's issue tracker is used to coordinate development.

The master branch represents the current version that is published on CRAN, the dev branch is the current development version.

Requirements

Contribute

Please get in touch with the community contact of the geostatistics community and read the Get Involved page if you want to become a contributor -- contributions are welcome!

You can also dive right in and join the chat room: Join the chat at https://gitter.im/52North/sos4R

Development, versions, and branches

Users may install the current development version or local branches using respective functions of devtools.

Documentation

News

The latest changes for every version are documented in the file NEWS.md in the package root directory. Open a preview with pkgdown::build_news().

R function documentation

Package documentation is based on .Rd files (regarding switch to roxygen see https://github.com/52North/sos4R/issues/21). The file NAMESPACE is not managed by roxygen2 either.

Update website

Knit README.Rmd to create README.md.

Run pkgdown from the package directory each time you release your package:

pkgdown::build_site()

Build vignettes

The vignettes should build as part of the docs website or package check process. To build single vignettes manually you can use

rmarkdown::render("vignettes/sos4R.Rmd")

or

pkgdown::build_article("sos4R-vignette-04-extensions")

Note that some of the vignettes are not build as part of the package check since there are timeout problems, but only as part of the pkgdown website. These vignettes do not have a vignette: element in the Rmd document header and are ignored via .Rbuildignore.

Package structure

sos4R follows the regular R extension package structure. General documentation about R package development can be found at the following two websites.

/R

The actual source files in the /R directory follow a naming schema:

/sandbox

In addition to the regular directories, the /sandbox folder contains a wild list of R scripts with tests and demos etc. Code in this directory is not exported from the package but is used during development to test during the implementation of (new) functionality. Please consider using this extensively as a history to be able to resolve problems that occurred before and to document what is working and what not. It is also recommended to run related tests again after (even minor) changes in the code.

Naming of functions, defaults, and constants

The following guidelines are a non extensive list of naming rules that were used within the package. Please also browse through the code files before starting to develop new functions to get to know the structures that are already in place so that a good user experience can be ensured.

Classes

Data models, i.e. requests and responses, are modelled as S4 classes. Documentation can be found at the following sites (and others):

Troubleshooting

Examples

Make sure that the examples, i.e., code in .Rd files, work without internet connections. sos4R has been called out for that a few times for breakign CRAN policy, which is not our intention. One way to make sure the examples work without internet connection is to run a container without network and R CMD check in there - see comments in docker/Dockerfile for instructions how to do that.

Tests

Tests are implemented with testthat. Run them with "Ctrl + Alt + T" in RStudio, with the RStudio UI via Build → More → Test Package, or with

devtools::test()

Using Docker

The docker folder contains a Dockerfile that can be used to set-up an isolated container just for sos4R development. This includes all required dependencies, RStudio as webapplication, and devtools.

  1. Clone this repository.
  2. Change to the docker subfolder in any terminal of your choice.
  3. Perform the following command to build the image locally: docker build -t sos4r-rstudio-dev:$(date +%Y-%m-%d) .. On windows, you need to replace $(date +%Y-%m-%d) with something useful, like 2019-02-27.
  4. Start the image as new container using the following command: docker run --name=sos4r-dev --env PASSWORD=r --publish 8787:8787 --volume /YOUR_PATH_TO/sos4R/:/home/rstudio/sos4R -d sos4r-rstudio-dev:2019-02-27 You can start and stop the container by its name sos4r-dev.
  5. Point your browser to http://localhost:8787/.
  6. Login with Username rstudio and Password r. If the password is not secure enough, please delete the container via docker stop sos4r-dev; docker rm sos4r-dev and re-run the above docker run ... with a different value for PASSWORD.
  7. Open the sos4R project via menu FileOpen Project → open folder sos4R → select sos4R.Rproj.
  8. Start developing.

Add features

See Versions and Branches for information about the release flow. In your new feature branch, implement the feature. Add tests.

Releases

A new release shall be uploaded to CRAN after testing and under the following procedure:



52North/sos4R documentation built on Jan. 30, 2021, 11:42 p.m.