This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(devtools) # someday this will be switchr ;-) | |
install_github("duncantl/CodeDepends") | |
library(knitr) | |
library(CodeDepends) | |
## package you're dealing with (pkgname) MUST be loaded before calling this | |
vignetteCoverage = function(pkgdir, pkgname = basename(pkgdir), vignexts = c(".Rmd", ".Rnw")) { | |
vigns = list.files(file.path(pkgdir, "vignettes"), pattern = paste0("(", paste(vignexts, collapse="|"), ")"), full.names=TRUE) | |
tmpfils = sapply(seq(along=vigns), function(x) tempfile( fileext=".R")) | |
rfils = mapply(function(inp, out) knit(inp, out, tangle=TRUE), inp = vigns, out = tmpfils) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```{r} | |
fancystopifnot = function(obj, condfun) { | |
x = capture.output(str(obj)) | |
if(!condfun(obj)) stop(paste(c("Condition not met, got", x), | |
collapse = "\n\t"))} | |
fancystopifnot(data.frame(x = sample(1:100, 10), | |
y = sample(c("a", "b"), 10, replace=TRUE)), | |
is.integer) | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> sessionInfo() | |
R version 3.1.0 (2014-04-10) | |
Platform: x86_64-pc-linux-gnu (64-bit) | |
locale: | |
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C | |
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 | |
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 | |
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C | |
[9] LC_ADDRESS=C LC_TELEPHONE=C |
NewerOlder