new_r_test: Wrapper: 'new_r' + 'new_test'

Description Usage Arguments Value References See Also Examples

Description

Quickly produce a roxygen2 style.R’ and testthat style test ‘.R’ template files from a function (output file will include the function) or a character string. Wraps new_r and new_test function capabilities into one function call.

Usage

1
2
new_r_test(fun, r.path = "R", r.file.name = NULL,
  test.path = "tests/testthat", test.file.name = NULL)

Arguments

fun

A function or character string naming the function.

r.path

Path to directory to generate the function test in. Default is to use "R" for ease of use within RStudio.

r.file.name

By default the file is named the same as fun + ".R". This can be changed by supplying a file name to file.name.

test.path

Path to directory to generate the function test in. Default is to use "tests/testthat" for ease of use within RStudio.

test.file.name

By default the file is named the same as:
"text-" + fun + ".R".
This can be changed by supplying a file name to file.name.

Value

Generates ‘____.R’ and ‘test-____.R’ files.

References

http://r-pkgs.had.co.nz/man.html
http://r-pkgs.had.co.nz/tests.html

See Also

Other new functions: new_data, new_r, new_test, new_vignette

Examples

1
2
3
4
dir.create("temp_dir")
new_r_test(paste, r.path = "temp_dir", test.path = "temp_dir")
new_r_test("myfun", r.path = "temp_dir", test.path = "temp_dir")
unlink("temp_dir", TRUE, TRUE)

trinker/pax documentation built on May 31, 2019, 9:42 p.m.