janosgyerik / r-hello

A sample package in R

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

r-hello

A sample package in R

Unit testing

Install devtools and testthat:

install.packages('devtools')
install.packages('testthat')

Load devtools library:

library(devtools)

Create basic testing infrastructure:

# navigate to your project dir
setwd('path/to/project')
test('.')  # will ask you to create testing infrastructure, press 1 Enter

Create tests in files named test*.R inside tests/testthat, and run again test('.').

See the docs of testthat on how to write unit tests.

Links

About

A sample package in R


Languages

Language:R 100.0%