## The most awkward thing here is doing the mocking up directory
## structures to mess with.
create_dirs <- function(root, x) {
for (i in x) {
dir.create(file.path(root, i), FALSE, TRUE)
}
}
random_file <- function(path, max_len) {
n <- sample(max_len)
pool <- c(0:9, LETTERS, letters, " ", "\n")
writeLines(paste(c(sample(pool, n, TRUE), "\n"), collapse=""), path)
}
## This might move into the package at some point
diff_bin <- function() {
Sys_which("diff")
}
diff_dirs <- function(path1, path2) {
system3(diff_bin(), c("-rq", path1, path2))$code == 0L
}
with_wd <- function(wd, expr) {
owd <- setwd(wd)
on.exit(setwd(owd))
expr
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.