
Untitled
By: a guest on
May 7th, 2012 | syntax:
None | size: 0.81 KB | hits: 15 | expires: Never
Is it possible to use R package data in testthat tests or run_examples()?
/ mypackage
/ data
* foo.txt, bar.csv
/ inst
/ tests
* run-all.R, test_1.R
/ man
/ R
#' Foo data
#'
#' Sample foo data
#'
#' @name foo
#' @docType data
NULL
#' Bar data
#'
#' Sample bar data
#'
#' @name bar
#' @docType data
NULL
data(foo)
data(bar)
expect_that(foo$col[1], equals(bar$col[1]))
#' @examples
#' data(foo)
#' functionThatUsesFoo(foo)
#' @examples
#' dontrun{data(foo)}
#' dontrun{functionThatUsesFoo(foo)}
foo <- read.delim(pathToFoo, sep="t", fill = TRUE, comment.char="#")
bar <- read.delim(pathToBar, sep=";", fill = TRUE, comment.char="#"
expect_that(foo$col[1], equals(bar$col[1]))