From 73fa0292e09de3e1ff0ab6ab816b02bc043b9bdc Mon Sep 17 00:00:00 2001 From: gfinak Date: Mon, 9 Jul 2018 10:09:53 -0700 Subject: [PATCH] Address point 1 of #32 - remove "name" property of yaml - update tests - upate code - update yaml_config.rmd - update vignette links --- R/yamlR.R | 10 +- README.md | 8 +- tests/testthat/test-skeleton.R | 197 +++++++++++++++---------------- vignettes/YAML_CONFIG.R | 8 +- vignettes/YAML_CONFIG.Rmd | 16 +-- vignettes/YAML_CONFIG.html | 94 ++++----------- vignettes/YAML_CONFIG.md | 85 ++----------- vignettes/usingDataPackageR.Rmd | 4 +- vignettes/usingDataPackageR.html | 83 ++++++------- vignettes/usingDataPackageR.md | 55 ++++----- 10 files changed, 218 insertions(+), 342 deletions(-) diff --git a/R/yamlR.R b/R/yamlR.R index d213518..d621af7 100644 --- a/R/yamlR.R +++ b/R/yamlR.R @@ -48,7 +48,7 @@ yml_add_files <- function(config, filenames) { for (i in filenames) { if (is.null(config[["configuration"]][["files"]][[i]])) { config[["configuration"]][["files"]][[i]] <- list() - config[["configuration"]][["files"]][[i]]$name <- i + # config[["configuration"]][["files"]][[i]]$name <- i config[["configuration"]][["files"]][[i]]$enabled <- TRUE } } @@ -124,8 +124,10 @@ yml_list_files <- function(config) { # assume config is a package root path config <- yml_find(config) } - cat(unlist(purrr::map(config[["configuration"]][["files"]], "name"))) - invisible(unlist(purrr::map(config[["configuration"]][["files"]], "name"))) + # cat(unlist(purrr::map(config[["configuration"]][["files"]], "name"))) + cat(names(config[["configuration"]][["files"]])) + # invisible(unlist(purrr::map(config[["configuration"]][["files"]], "name"))) + invisible(names(config[["configuration"]][["files"]])) } #' @rdname yaml @@ -221,7 +223,7 @@ construct_yml_config <- function(code = NULL, data = NULL, render_root = NULL) { files <- vector(length = length(code), mode = "list") names(files) <- code for (i in code) { - files[[i]]$name <- i + # files[[i]]$name <- i files[[i]]$enabled <- TRUE } # create render root at a temporary directory. diff --git a/README.md b/README.md index 8cb0acc..d0630c9 100644 --- a/README.md +++ b/README.md @@ -201,7 +201,7 @@ DataPackageR::datapackage_skeleton( #> Saving functions and data ... #> Making help files ... #> Done. -#> Further steps are described in '/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T//RtmpNPoc2o/mtcars20/Read-and-delete-me'. +#> Further steps are described in '/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T//RtmprT0WSs/mtcars20/Read-and-delete-me'. #> Adding DataVersion string to DESCRIPTION #> Creating data and data-raw directories #> configuring yaml file @@ -214,12 +214,12 @@ DataPackageR:::package_build(file.path(tempdir(),"mtcars20")) #> processing file: subsetCars.Rmd #> output file: subsetCars.knit.md #> -#> Output created: /private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpNPoc2o/mtcars20/inst/extdata/Logfiles/subsetCars.html +#> Output created: /private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmprT0WSs/mtcars20/inst/extdata/Logfiles/subsetCars.html #> First time using roxygen2. Upgrading automatically... -#> Updating roxygen version in /private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpNPoc2o/mtcars20/DESCRIPTION +#> Updating roxygen version in /private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmprT0WSs/mtcars20/DESCRIPTION #> '/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file \ #> --no-environ --no-save --no-restore --quiet CMD build \ -#> '/private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpNPoc2o/mtcars20' \ +#> '/private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmprT0WSs/mtcars20' \ #> --no-resave-data --no-manual --no-build-vignettes #> diff --git a/tests/testthat/test-skeleton.R b/tests/testthat/test-skeleton.R index 0bdf4a6..316b194 100644 --- a/tests/testthat/test-skeleton.R +++ b/tests/testthat/test-skeleton.R @@ -3,19 +3,18 @@ context("datapackage skeleton") test_that("datapackage skeleton builds correct structure", { file <- system.file("extdata", "tests", "subsetCars.Rmd", package = "DataPackageR") - tmp <<- tempdir() - tmp <<- normalizePath(tmp, winslash = "/", mustWork = TRUE) + # normalizePath(tempdir(), winslash = "/", mustWork = TRUE) expect_null( datapackage_skeleton( name = "subsetCars", - path = tmp, + path = tempdir(), code_files = c(file), force = TRUE, r_object_names = "cars_over_20" ) ) - unlink(file.path(tmp, "subsetCars"), + unlink(file.path(tempdir(), "subsetCars"), recursive = TRUE, force = TRUE) }) @@ -26,7 +25,7 @@ test_that("package can be built from different locations", { package = "DataPackageR") datapackage_skeleton( name = "subsetCars", - path = tmp, + path = tempdir(), code_files = c(file), force = TRUE, r_object_names = "cars_over_20" @@ -34,15 +33,15 @@ test_that("package can be built from different locations", { expect_equal( basename( package_build( - file.path(tmp, "subsetCars"))), + file.path(tempdir(), "subsetCars"))), "subsetCars_1.0.tar.gz") old <- - setwd(file.path(tmp, "subsetCars")) + setwd(file.path(tempdir(), "subsetCars")) on.exit(setwd(old)) expect_equal(basename(package_build(".")), "subsetCars_1.0.tar.gz") - expect_error(package_build("subsetCars")) - unlink(file.path(tmp, "subsetCars"), + suppressWarnings(expect_error(package_build("subsetCars"))) + unlink(file.path(tempdir(), "subsetCars"), recursive = TRUE, force = TRUE) }) @@ -54,7 +53,7 @@ test_that("yaml reading, adding, removing, listing, and writing", { expect_null( datapackage_skeleton( name = "subsetCars", - path = tmp, + path = tempdir(), code_files = c(file), force = TRUE, r_object_names = "cars_over_20" @@ -65,12 +64,12 @@ test_that("yaml reading, adding, removing, listing, and writing", { structure(list( configuration = list( files = list(subsetCars.Rmd = - list(name = "subsetCars.Rmd", enabled = TRUE)), + list(enabled = TRUE)), objects = "cars_over_20", render_root = "dummy" ) )) - config <- yml_find(file.path(tmp, "subsetCars")) + config <- yml_find(file.path(tempdir(), "subsetCars")) config$configuration$render_root <- "dummy" attr(test_config, "path") <- attr(config, "path") expect_identical(config, test_config) @@ -80,8 +79,8 @@ test_that("yaml reading, adding, removing, listing, and writing", { structure(list( configuration = list( files = list( - subsetCars.Rmd = list(name = "subsetCars.Rmd", enabled = TRUE), - extra.rmd = list(name = "extra.rmd", enabled = TRUE) + subsetCars.Rmd = list(enabled = TRUE), + extra.rmd = list(enabled = TRUE) ), objects = "cars_over_20", render_root = "dummy" @@ -97,8 +96,8 @@ test_that("yaml reading, adding, removing, listing, and writing", { structure(list( configuration = list( files = list( - subsetCars.Rmd = list(name = "subsetCars.Rmd", enabled = TRUE), - extra.rmd = list(name = "extra.rmd", enabled = TRUE) + subsetCars.Rmd = list(enabled = TRUE), + extra.rmd = list(enabled = TRUE) ), objects = "cars_over_20", render_root = "dummy" @@ -114,8 +113,8 @@ test_that("yaml reading, adding, removing, listing, and writing", { structure(list( configuration = list( files = list( - subsetCars.Rmd = list(name = "subsetCars.Rmd", enabled = TRUE), - extra.rmd = list(name = "extra.rmd", enabled = TRUE) + subsetCars.Rmd = list(enabled = TRUE), + extra.rmd = list(enabled = TRUE) ), objects = c("cars_over_20", "foo_obj"), @@ -133,8 +132,8 @@ test_that("yaml reading, adding, removing, listing, and writing", { structure(list( configuration = list( files = list( - subsetCars.Rmd = list(name = "subsetCars.Rmd", enabled = TRUE), - extra.rmd = list(name = "extra.rmd", enabled = TRUE) + subsetCars.Rmd = list(enabled = TRUE), + extra.rmd = list(enabled = TRUE) ), objects = "cars_over_20", render_root = "dummy" @@ -147,8 +146,7 @@ test_that("yaml reading, adding, removing, listing, and writing", { list <- yml_list_files(config) expect_identical(list, - c(subsetCars.Rmd = "subsetCars.Rmd", - extra.rmd = "extra.rmd")) + c("subsetCars.Rmd","extra.rmd")) @@ -161,19 +159,19 @@ test_that("yaml reading, adding, removing, listing, and writing", { structure(list( configuration = list( files = list( - subsetCars.Rmd = list(name = "subsetCars.Rmd", enabled = TRUE), - extra.rmd = list(name = "extra.rmd", enabled = TRUE) + subsetCars.Rmd = list(enabled = TRUE), + extra.rmd = list(enabled = TRUE) ), objects = "cars_over_20", render_root = "dummy" ) ), path = "/private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/Rtmp7DyEjM/subsetCars/datapackager.yml") # nolint - config <- yml_find(file.path(tmp, "subsetCars")) + config <- yml_find(file.path(tempdir(), "subsetCars")) attr(test_config, "path") <- attr(config, "path") config$configuration$render_root <- "dummy" expect_identical(config, test_config) - unlink(file.path(tmp, "subsetCars"), + unlink(file.path(tempdir(), "subsetCars"), recursive = TRUE, force = TRUE) }) @@ -187,23 +185,23 @@ test_that("can add a data item", { expect_null( datapackage_skeleton( name = "subsetCars", - path = tmp, + path = tempdir(), code_files = c(file, file2), force = TRUE, r_object_names = c("cars_over_20") ) ) - package_build(file.path(tmp, "subsetCars")) - expect_equal(list.files(file.path(tmp, "subsetCars", "data")), + package_build(file.path(tempdir(), "subsetCars")) + expect_equal(list.files(file.path(tempdir(), "subsetCars", "data")), "cars_over_20.rda") expect_true(all( c("subsetCars", "cars_over_20") %in% names(DataPackageR:::.doc_parse( - list.files(file.path(tmp, "subsetCars", "R"), + list.files(file.path(tempdir(), "subsetCars", "R"), full.names = TRUE) )) )) - unlink(file.path(tmp, "subsetCars"), + unlink(file.path(tempdir(), "subsetCars"), recursive = TRUE, force = TRUE) }) @@ -216,28 +214,28 @@ test_that("can remove a data item", { expect_null( datapackage_skeleton( name = "subsetCars", - path = tmp, + path = tempdir(), code_files = c(file, file2), force = TRUE, r_object_names = c("cars_over_20", "pressure") ) ) - package_build(file.path(tmp, "subsetCars")) + package_build(file.path(tempdir(), "subsetCars")) # have we saved the new object? - config <- yml_find(file.path(tmp, "subsetCars")) + config <- yml_find(file.path(tempdir(), "subsetCars")) config <- yml_disable_compile(config, basename(file2)) yml_write(config) - package_build(file.path(tmp, "subsetCars")) - expect_equal(list.files(file.path(tmp, "subsetCars", "data")), + package_build(file.path(tempdir(), "subsetCars")) + expect_equal(list.files(file.path(tempdir(), "subsetCars", "data")), c("cars_over_20.rda", "pressure.rda")) expect_true(all( c("subsetCars", "cars_over_20", "pressure") %in% names(DataPackageR:::.doc_parse( - list.files(file.path(tmp, "subsetCars", "R"), + list.files(file.path(tempdir(), "subsetCars", "R"), full.names = TRUE) )) )) - unlink(file.path(tmp, "subsetCars"), + unlink(file.path(tempdir(), "subsetCars"), recursive = TRUE, force = TRUE) }) @@ -250,18 +248,18 @@ test_that("can_read_pkg_description, data_version", { package = "DataPackageR") datapackage_skeleton( name = "subsetCars", - path = tmp, + path = tempdir(), code_files = c(file, file2), force = TRUE, r_object_names = c("cars_over_20", "pressure") ) - DataPackageR:::read_pkg_description(file.path(tmp, "subsetCars")) - devtools::load_all(file.path(tmp, "subsetCars")) + DataPackageR:::read_pkg_description(file.path(tempdir(), "subsetCars")) + devtools::load_all(file.path(tempdir(), "subsetCars")) expected_version <- structure(list(c(0L, 1L, 0L)), class = c("package_version", "numeric_version")) expect_equal(data_version("subsetCars"), expected_version) - unlink(file.path(tmp, "subsetCars"), + unlink(file.path(tempdir(), "subsetCars"), recursive = TRUE, force = TRUE) }) @@ -276,7 +274,7 @@ test_that("edge cases work as expected", { expect_error( datapackage_skeleton( name = NULL, - path = tmp, + path = tempdir(), code_files = c(file1, file2), force = TRUE, r_object_names = c("cars_over_20", "pressure") @@ -285,12 +283,12 @@ test_that("edge cases work as expected", { datapackage_skeleton( name = "subsetCars", list = list(), - path = tmp, + path = tempdir(), code_files = c(file2), force = TRUE, r_object_names = c("cars_over_20") ) - unlink(file.path(tmp, "subsetCars"), + unlink(file.path(tempdir(), "subsetCars"), recursive = TRUE, force = TRUE) }) @@ -304,30 +302,30 @@ test_that("can add a file", { expect_null( datapackage_skeleton( name = "subsetCars", - path = tmp, + path = tempdir(), code_files = c(file), force = TRUE, r_object_names = c("cars_over_20") ) ) - package_build(file.path(tmp, "subsetCars")) - expect_equal(list.files(file.path(tmp, "subsetCars", "data")), + package_build(file.path(tempdir(), "subsetCars")) + expect_equal(list.files(file.path(tempdir(), "subsetCars", "data")), "cars_over_20.rda") expect_true(all( c("subsetCars", "cars_over_20") %in% names(DataPackageR:::.doc_parse( - list.files(file.path(tmp, "subsetCars", "R"), full.names = TRUE) + list.files(file.path(tempdir(), "subsetCars", "R"), full.names = TRUE) )) )) - config <- yml_find(file.path(tmp, "subsetCars")) + config <- yml_find(file.path(tempdir(), "subsetCars")) config <- yml_add_files(config, "extra.rmd") yml_write(config) - file.copy(from = file2, file.path(tmp, "subsetCars", "data-raw")) - expect_equal(basename(package_build(file.path(tmp, + file.copy(from = file2, file.path(tempdir(), "subsetCars", "data-raw")) + expect_equal(basename(package_build(file.path(tempdir(), "subsetCars"))), "subsetCars_1.0.tar.gz") expect_equal(names(DataPackageR:::.doc_parse( - list.files(file.path(tmp, + list.files(file.path(tempdir(), "subsetCars", "R"), full.names = TRUE) @@ -335,22 +333,22 @@ test_that("can add a file", { c("subsetCars", "cars_over_20")) config <- yml_add_objects(config, "pressure") yml_write(config) - expect_equal(basename(package_build(file.path(tmp, + expect_equal(basename(package_build(file.path(tempdir(), "subsetCars"))), "subsetCars_1.0.tar.gz") expect_equal(names(DataPackageR:::.doc_parse( - list.files(file.path(tmp, + list.files(file.path(tempdir(), "subsetCars", "R"), full.names = TRUE) )), c("subsetCars", "cars_over_20", "pressure")) expect_equal(basename(list.files( - file.path(tmp, "subsetCars", "data"), + file.path(tempdir(), "subsetCars", "data"), full.names = TRUE )), c("cars_over_20.rda", "pressure.rda")) - unlink(file.path(tmp, "subsetCars"), + unlink(file.path(tempdir(), "subsetCars"), recursive = TRUE, force = TRUE) }) @@ -363,18 +361,18 @@ test_that("auto bump version when data unchanged", { expect_null( datapackage_skeleton( name = "subsetCars", - path = tmp, + path = tempdir(), code_files = c(file), force = TRUE, r_object_names = c("cars_over_20") ) ) - package_build(file.path(tmp, "subsetCars")) - pkg <- desc::desc(file.path(tmp, "subsetCars")) + package_build(file.path(tempdir(), "subsetCars")) + pkg <- desc::desc(file.path(tempdir(), "subsetCars")) pkg$set("DataVersion", "0.0.0") pkg$write() - package_build(file.path(tmp, "subsetCars")) - unlink(file.path(tmp, "subsetCars"), + package_build(file.path(tempdir(), "subsetCars")) + unlink(file.path(tempdir(), "subsetCars"), recursive = TRUE, force = TRUE) }) @@ -388,18 +386,18 @@ test_that("manual bump version when data unchanged", { expect_null( datapackage_skeleton( name = "subsetCars", - path = tmp, + path = tempdir(), code_files = c(file), force = TRUE, r_object_names = c("cars_over_20") ) ) - package_build(file.path(tmp, "subsetCars")) - pkg <- desc::desc(file.path(tmp, "subsetCars")) + package_build(file.path(tempdir(), "subsetCars")) + pkg <- desc::desc(file.path(tempdir(), "subsetCars")) pkg$set("DataVersion", "0.2.0") pkg$write() - package_build(file.path(tmp, "subsetCars")) - unlink(file.path(tmp, "subsetCars"), + package_build(file.path(tempdir(), "subsetCars")) + unlink(file.path(tempdir(), "subsetCars"), recursive = TRUE, force = TRUE) }) @@ -413,23 +411,23 @@ test_that("data changes but version out of sync", { expect_null( datapackage_skeleton( name = "subsetCars", - path = tmp, + path = tempdir(), code_files = c(file), force = TRUE, r_object_names = c("cars_over_20") ) ) - package_build(file.path(tmp, "subsetCars")) - config <- yml_find(file.path(tmp, "subsetCars")) + package_build(file.path(tempdir(), "subsetCars")) + config <- yml_find(file.path(tempdir(), "subsetCars")) config <- yml_add_files(config, "extra.rmd") config <- yml_add_objects(config, "pressure") - file.copy(file2, file.path(tmp, "subsetCars", "data-raw")) + file.copy(file2, file.path(tempdir(), "subsetCars", "data-raw")) yml_write(config) - pkg <- desc::desc(file.path(tmp, "subsetCars")) + pkg <- desc::desc(file.path(tempdir(), "subsetCars")) pkg$set("DataVersion", "0.0.0") pkg$write() - package_build(file.path(tmp, "subsetCars")) - unlink(file.path(tmp, "subsetCars"), + package_build(file.path(tempdir(), "subsetCars")) + unlink(file.path(tempdir(), "subsetCars"), recursive = TRUE, force = TRUE) }) @@ -438,22 +436,21 @@ context("varying arguments") test_that("package built in different edge cases", { file <- system.file("extdata", "tests", "subsetCars.Rmd", package = "DataPackageR") - tmp <- tempdir() datapackage_skeleton( name = "subsetCars", - path = tmp, + path = tempdir(), code_files = c(file), force = TRUE, r_object_names = "cars_over_20" ) expect_error(package_build(packageName = NULL)) - old <- setwd(file.path(tmp, "subsetCars")) + old <- setwd(file.path(tempdir(), "subsetCars")) on.exit(setwd(old)) expect_equal(basename(package_build(packageName = NULL)), "subsetCars_1.0.tar.gz") - expect_equal(yml_list_objects(file.path(tmp, "subsetCars")), "cars_over_20") + expect_equal(yml_list_objects(file.path(tempdir(), "subsetCars")), "cars_over_20") - config <- yml_find(file.path(tmp, "subsetCars")) + config <- yml_find(file.path(tempdir(), "subsetCars")) config[["configuration"]]$render_root <- "" expect_equal(DataPackageR:::.get_render_root(config), "") config[["configuration"]]$render_root <- NULL @@ -471,51 +468,51 @@ test_that("package built in different edge cases", { which = "path") ) suppressWarnings(expect_error(DataPackageR:::DataPackageR(tempdir()))) - unlink(file.path(tmp, "foo"), + unlink(file.path(tempdir(), "foo"), force = TRUE, recursive = TRUE) - package.skeleton("foo", path = tmp) + package.skeleton("foo", path = tempdir()) suppressWarnings(expect_error( DataPackageR:::DataPackageR( - file.path(tmp, "foo")))) - dir.create(file.path(tmp, "foo", "data-raw")) + file.path(tempdir(), "foo")))) + dir.create(file.path(tempdir(), "foo", "data-raw")) suppressWarnings(expect_error( DataPackageR:::DataPackageR( - file.path(tmp, "foo")))) - unlink(file.path(tmp, "foo", "R"), + file.path(tempdir(), "foo")))) + unlink(file.path(tempdir(), "foo", "R"), recursive = TRUE, force = TRUE) - unlink(file.path(tmp, "foo", "inst"), + unlink(file.path(tempdir(), "foo", "inst"), recursive = TRUE, force = TRUE) suppressWarnings(expect_error( DataPackageR:::DataPackageR( - file.path(tmp, "foo")))) - unlink(file.path(tmp, "foo"), + file.path(tempdir(), "foo")))) + unlink(file.path(tempdir(), "foo"), force = TRUE, recursive = TRUE) package.skeleton("foo", path = tempdir(),force=TRUE) expect_error(yml_find(file.path(tempdir(), "foo"))) - dir.create(file.path(tmp, "foo", "data-raw")) - unlink(file.path(tmp, "foo", "DESCRIPTION")) + dir.create(file.path(tempdir(), "foo", "data-raw")) + unlink(file.path(tempdir(), "foo", "DESCRIPTION")) yml <- DataPackageR:::construct_yml_config("foo.Rmd") - yml_write(yml, path = file.path(tmp, "foo")) + yml_write(yml, path = file.path(tempdir(), "foo")) suppressWarnings(expect_error( DataPackageR:::DataPackageR( - file.path(tmp, "foo")))) + file.path(tempdir(), "foo")))) yml$configuration$files <- " " - yml_write(yml, path = file.path(tmp, "foo")) - expect_error(DataPackageR:::DataPackageR(file.path(tmp, "foo"))) + yml_write(yml, path = file.path(tempdir(), "foo")) + expect_error(DataPackageR:::DataPackageR(file.path(tempdir(), "foo"))) - unlink(file.path(tmp, "foo"), + unlink(file.path(tempdir(), "foo"), force = TRUE, recursive = TRUE) suppressWarnings(expect_error(construct_yml_config("foo", render_root = "bar"))) - unlink(file.path(tmp, "subsetCars"), + unlink(file.path(tempdir(), "subsetCars"), recursive = TRUE, force = TRUE) @@ -556,7 +553,7 @@ test_that("package built in different edge cases", { list(DataVersion = "1.a.1") ))) - unlink(file.path(tmp, "foo"), + unlink(file.path(tempdir(), "foo"), force = TRUE, recursive = TRUE) package.skeleton("foo", path = tempdir()) @@ -574,7 +571,7 @@ test_that("package built in different edge cases", { )) })) - unlink(file.path(tmp, "foo"), + unlink(file.path(tempdir(), "foo"), force = TRUE, recursive = TRUE) suppressWarnings(expect_error(yml_list_objects("foo"))) @@ -625,7 +622,7 @@ test_that("package built in different edge cases", { ) unlink("foo", recursive = TRUE, force = TRUE) expect_error(DataPackageR:::read_pkg_description("foo")) - unlink(file.path(tmp, "foo"), + unlink(file.path(tempdir(), "foo"), force = TRUE, recursive = TRUE) package.skeleton(path = tempdir(), "foo") @@ -726,7 +723,7 @@ test_that("assert_data_version", { package_build(file.path(tempdir(), pname)) devtools::load_all(file.path(tempdir(), pname)) - expect_true(dataVersion(pkg = pname) == numeric_version("0.1.0")) + suppressWarnings(expect_true(dataVersion(pkg = pname) == numeric_version("0.1.0"))) expect_true( assert_data_version( data_package_name = pname, diff --git a/vignettes/YAML_CONFIG.R b/vignettes/YAML_CONFIG.R index 9056056..f5d5757 100644 --- a/vignettes/YAML_CONFIG.R +++ b/vignettes/YAML_CONFIG.R @@ -44,25 +44,25 @@ cat(as.yaml(yml_enabled)) yml_twofiles <- yml_add_files( yml, filenames = "anotherFile.Rmd") -cat(as.yaml(yml_twofiles)) +# cat(as.yaml(yml_twofiles)) ## ---- comment="", echo = 1----------------------------------------------- yml_twoobj <- yml_add_objects( yml_twofiles, objects = "another_object") -cat(as.yaml(yml_twoobj)) +# cat(as.yaml(yml_twoobj)) ## ---- comment="", echo = 1----------------------------------------------- yml_twoobj <- yml_remove_files( yml_twoobj, filenames = "anotherFile.Rmd") -cat(as.yaml(yml_twoobj)) +# cat(as.yaml(yml_twoobj)) ## ---- comment="", echo = 1----------------------------------------------- yml_oneobj <- yml_remove_objects( yml_twoobj, objects = "another_object") -cat(as.yaml(yml_oneobj)) +# cat(as.yaml(yml_oneobj)) ## ---- eval = FALSE------------------------------------------------------- # yml_write(yml_oneobj, path = "path_to_package") diff --git a/vignettes/YAML_CONFIG.Rmd b/vignettes/YAML_CONFIG.Rmd index a82c3c0..afbc928 100644 --- a/vignettes/YAML_CONFIG.Rmd +++ b/vignettes/YAML_CONFIG.Rmd @@ -48,12 +48,12 @@ It has three properties: The files (`R` or `Rmd`) to be processed by DataPackageR. They are processed in the order shown. Users running multi-script workflows with dependencies between the scripts need to ensure the files are processed in the correct order. - Here `subsetCars.Rmd` is the only file to process. + Here `subsetCars.Rmd` is the only file to process. The name is transformed to an absolute path within the package. - Each file itself has several properties: + Each file itself has just one property: - - `name:` - The name of the file. This is transformed to an absolute path within the package. + + - `enabled:` A logical `yes`, `no` flag indicating whether the file should be rendered during the build, or whether it should be skipped. @@ -163,7 +163,7 @@ cat(as.yaml(yml_enabled)) yml_twofiles <- yml_add_files( yml, filenames = "anotherFile.Rmd") -cat(as.yaml(yml_twofiles)) +# cat(as.yaml(yml_twofiles)) ``` #### `yml_add_objects` @@ -176,7 +176,7 @@ cat(as.yaml(yml_twofiles)) yml_twoobj <- yml_add_objects( yml_twofiles, objects = "another_object") -cat(as.yaml(yml_twoobj)) +# cat(as.yaml(yml_twoobj)) ``` #### `yml_remove_files` @@ -189,7 +189,7 @@ cat(as.yaml(yml_twoobj)) yml_twoobj <- yml_remove_files( yml_twoobj, filenames = "anotherFile.Rmd") -cat(as.yaml(yml_twoobj)) +# cat(as.yaml(yml_twoobj)) ``` #### `yml_remove_objects` @@ -202,7 +202,7 @@ cat(as.yaml(yml_twoobj)) yml_oneobj <- yml_remove_objects( yml_twoobj, objects = "another_object") -cat(as.yaml(yml_oneobj)) +# cat(as.yaml(yml_oneobj)) ``` #### `yml_write` diff --git a/vignettes/YAML_CONFIG.html b/vignettes/YAML_CONFIG.html index 9410305..211e73a 100644 --- a/vignettes/YAML_CONFIG.html +++ b/vignettes/YAML_CONFIG.html @@ -306,11 +306,10 @@

The datapackager.yml file.

configuration:
   files:
     subsetCars.Rmd:
-      name: subsetCars.Rmd
       enabled: yes
   objects: cars_over_20
   render_root:
-    tmp: '738856'
+ tmp: '134702'

YAML config file properties.

@@ -319,11 +318,12 @@

YAML config file properties.

@@ -412,11 +411,10 @@
Example
configuration:
   files:
     subsetCars.Rmd:
-      name: subsetCars.Rmd
       enabled: yes
   objects: cars_over_20
   render_root:
-    tmp: '180706'
+ tmp: '929985'
@@ -430,25 +428,12 @@
Example
configuration:
   files:
     subsetCars.Rmd:
-      name: subsetCars.Rmd
       enabled: yes
     anotherFile.Rmd:
-      name: anotherFile.Rmd
       enabled: yes
   objects: cars_over_20
   render_root:
-    tmp: '180706'
-
configuration:
-  files:
-    subsetCars.Rmd:
-      name: subsetCars.Rmd
-      enabled: yes
-    anotherFile.Rmd:
-      name: anotherFile.Rmd
-      enabled: yes
-  objects: cars_over_20
-  render_root:
-    tmp: '180706'
+ tmp: '929985'
@@ -456,35 +441,20 @@

yml_add_objects

Add named objects to a config read by yml_find.

Example
- -
configuration:
-  files:
-    subsetCars.Rmd:
-      name: subsetCars.Rmd
-      enabled: yes
-    anotherFile.Rmd:
-      name: anotherFile.Rmd
-      enabled: yes
-  objects:
-  - cars_over_20
-  - another_object
-  render_root:
-    tmp: '180706'
+
configuration:
   files:
     subsetCars.Rmd:
-      name: subsetCars.Rmd
       enabled: yes
     anotherFile.Rmd:
-      name: anotherFile.Rmd
       enabled: yes
   objects:
   - cars_over_20
   - another_object
   render_root:
-    tmp: '180706'
+ tmp: '929985'
@@ -492,29 +462,18 @@

yml_remove_files

Remove named files from a config read by yml_find.

Example
- +
configuration:
   files:
     subsetCars.Rmd:
-      name: subsetCars.Rmd
       enabled: yes
   objects:
   - cars_over_20
   - another_object
   render_root:
-    tmp: '180706'
-
configuration:
-  files:
-    subsetCars.Rmd:
-      name: subsetCars.Rmd
-      enabled: yes
-  objects:
-  - cars_over_20
-  - another_object
-  render_root:
-    tmp: '180706'
+ tmp: '929985'
@@ -522,25 +481,16 @@

yml_remove_objects

Remove named objects from a config read by yml_find.

Example
- -
configuration:
-  files:
-    subsetCars.Rmd:
-      name: subsetCars.Rmd
-      enabled: yes
-  objects: cars_over_20
-  render_root:
-    tmp: '180706'
+
configuration:
   files:
     subsetCars.Rmd:
-      name: subsetCars.Rmd
       enabled: yes
   objects: cars_over_20
   render_root:
-    tmp: '180706'
+ tmp: '929985'
@@ -548,7 +498,7 @@

yml_write

Write a modified config to its package path.

Example
- +

The yml_oneobj read by yml_find() carries an attribute that is the path to the package. The user doesn’t need to pass a path to yml_write if the config has been read by yml_find.

diff --git a/vignettes/YAML_CONFIG.md b/vignettes/YAML_CONFIG.md index 17e0a59..781346a 100644 --- a/vignettes/YAML_CONFIG.md +++ b/vignettes/YAML_CONFIG.md @@ -35,11 +35,10 @@ The structure of a correctly formatted `datapackager.yml` file is shown below: configuration: files: subsetCars.Rmd: - name: subsetCars.Rmd enabled: yes objects: cars_over_20 render_root: - tmp: '738856' + tmp: '134702' ``` ## YAML config file properties. @@ -52,12 +51,12 @@ It has three properties: The files (`R` or `Rmd`) to be processed by DataPackageR. They are processed in the order shown. Users running multi-script workflows with dependencies between the scripts need to ensure the files are processed in the correct order. - Here `subsetCars.Rmd` is the only file to process. + Here `subsetCars.Rmd` is the only file to process. The name is transformed to an absolute path within the package. - Each file itself has several properties: + Each file itself has just one property: - - `name:` - The name of the file. This is transformed to an absolute path within the package. + + - `enabled:` A logical `yes`, `no` flag indicating whether the file should be rendered during the build, or whether it should be skipped. @@ -160,11 +159,10 @@ yml_disabled <- yml_disable_compile( configuration: files: subsetCars.Rmd: - name: subsetCars.Rmd enabled: no objects: cars_over_20 render_root: - tmp: '180706' + tmp: '929985' ``` #### `yml_enable_compile` @@ -184,11 +182,10 @@ yml_enabled <- yml_enable_compile( configuration: files: subsetCars.Rmd: - name: subsetCars.Rmd enabled: yes objects: cars_over_20 render_root: - tmp: '180706' + tmp: '929985' ``` #### `yml_add_files` @@ -208,28 +205,12 @@ yml_twofiles <- yml_add_files( configuration: files: subsetCars.Rmd: - name: subsetCars.Rmd enabled: yes anotherFile.Rmd: - name: anotherFile.Rmd enabled: yes objects: cars_over_20 render_root: - tmp: '180706' -``` - -``` -configuration: - files: - subsetCars.Rmd: - name: subsetCars.Rmd - enabled: yes - anotherFile.Rmd: - name: anotherFile.Rmd - enabled: yes - objects: cars_over_20 - render_root: - tmp: '180706' + tmp: '929985' ``` #### `yml_add_objects` @@ -249,32 +230,14 @@ yml_twoobj <- yml_add_objects( configuration: files: subsetCars.Rmd: - name: subsetCars.Rmd - enabled: yes - anotherFile.Rmd: - name: anotherFile.Rmd - enabled: yes - objects: - - cars_over_20 - - another_object - render_root: - tmp: '180706' -``` - -``` -configuration: - files: - subsetCars.Rmd: - name: subsetCars.Rmd enabled: yes anotherFile.Rmd: - name: anotherFile.Rmd enabled: yes objects: - cars_over_20 - another_object render_root: - tmp: '180706' + tmp: '929985' ``` #### `yml_remove_files` @@ -294,26 +257,12 @@ yml_twoobj <- yml_remove_files( configuration: files: subsetCars.Rmd: - name: subsetCars.Rmd - enabled: yes - objects: - - cars_over_20 - - another_object - render_root: - tmp: '180706' -``` - -``` -configuration: - files: - subsetCars.Rmd: - name: subsetCars.Rmd enabled: yes objects: - cars_over_20 - another_object render_root: - tmp: '180706' + tmp: '929985' ``` #### `yml_remove_objects` @@ -333,22 +282,10 @@ yml_oneobj <- yml_remove_objects( configuration: files: subsetCars.Rmd: - name: subsetCars.Rmd - enabled: yes - objects: cars_over_20 - render_root: - tmp: '180706' -``` - -``` -configuration: - files: - subsetCars.Rmd: - name: subsetCars.Rmd enabled: yes objects: cars_over_20 render_root: - tmp: '180706' + tmp: '929985' ``` #### `yml_write` diff --git a/vignettes/usingDataPackageR.Rmd b/vignettes/usingDataPackageR.Rmd index 9bfe472..543fdf9 100644 --- a/vignettes/usingDataPackageR.Rmd +++ b/vignettes/usingDataPackageR.Rmd @@ -115,7 +115,7 @@ The objects must be listed in the yaml configuration file. `datapackage_skeleton DataPackageR provides an API for modifying this file, so it does not need to be done by hand. -Further information on the contents of the YAML configuration file, and the API are in the [YAML Configuration Details](YAML_CONFIG.html) +Further information on the contents of the YAML configuration file, and the API are in the [YAML Configuration Details](YAML_CONFIG.md) ### Where do I put raw data? @@ -237,7 +237,7 @@ assert_data_version(data_package_name = "mtcars20", Version 1.12.0 has moved away from controlling the build process using `datasets.R` and an additional `masterfile` argument. -The build process is now controlled via a `datapackager.yml` configuration file located in the package root directory. (see [YAML Configuration Details](YAML_CONFIG.html)) +The build process is now controlled via a `datapackager.yml` configuration file located in the package root directory. (see [YAML Configuration Details](YAML_CONFIG.md)) You can migrate an old package by constructing such a config file using the `construct_yml_config()` API. diff --git a/vignettes/usingDataPackageR.html b/vignettes/usingDataPackageR.html index a350757..58b5e33 100644 --- a/vignettes/usingDataPackageR.html +++ b/vignettes/usingDataPackageR.html @@ -361,7 +361,7 @@

Set up a new data package.

Saving functions and data ... Making help files ... Done. -Further steps are described in '/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T//RtmpXVZFpW/mtcars20/Read-and-delete-me'. +Further steps are described in '/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T//RtmpdnlBey/mtcars20/Read-and-delete-me'. Adding DataVersion string to DESCRIPTION Creating data and data-raw directories configuring yaml file @@ -391,16 +391,15 @@

A few words abou the YAML config file

configuration:
   files:
     subsetCars.Rmd:
-      name: subsetCars.Rmd
       enabled: yes
   objects: cars_over_20
   render_root:
-    tmp: '694862'
+ tmp: '158965'

The two main pieces of information in the configuration are a list of the files to be processed and the data sets the package will store.

This example packages an R data set named cars_over_20 (the name was passed in to datapackage_skeleton()). It is created by the subsetCars.Rmd file.

The objects must be listed in the yaml configuration file. datapackage_skeleton() ensures this is done for you automatically.

DataPackageR provides an API for modifying this file, so it does not need to be done by hand.

-

Further information on the contents of the YAML configuration file, and the API are in the YAML Configuration Details

+

Further information on the contents of the YAML configuration file, and the API are in the YAML Configuration Details

Where do I put raw data?

@@ -410,8 +409,8 @@

Where do I put raw data?

An API to locate data sets within an R or Rmd file.

To locate the data to read from the filesystem:

Raw data stored externally can be retreived relative to these paths.

@@ -423,36 +422,36 @@

Build the data package.

# Run the preprocessing code to build cars_over_20
 # and reproducibly enclose it in a package.
 DataPackageR:::package_build(file.path(tempdir(),"mtcars20"))
-INFO [2018-07-09 09:24:58] Logging to /private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpXVZFpW/mtcars20/inst/extdata/Logfiles/processing.log
-INFO [2018-07-09 09:24:58] Processing data
-INFO [2018-07-09 09:24:58] Reading yaml configuration
-INFO [2018-07-09 09:24:58] Found /private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpXVZFpW/mtcars20/data-raw/subsetCars.Rmd
-INFO [2018-07-09 09:24:58] Processing 1 of 1: /private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpXVZFpW/mtcars20/data-raw/subsetCars.Rmd
+INFO [2018-07-09 09:38:47] Logging to /private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpdnlBey/mtcars20/inst/extdata/Logfiles/processing.log
+INFO [2018-07-09 09:38:47] Processing data
+INFO [2018-07-09 09:38:47] Reading yaml configuration
+INFO [2018-07-09 09:38:47] Found /private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpdnlBey/mtcars20/data-raw/subsetCars.Rmd
+INFO [2018-07-09 09:38:47] Processing 1 of 1: /private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpdnlBey/mtcars20/data-raw/subsetCars.Rmd
 processing file: subsetCars.Rmd
 output file: subsetCars.knit.md
-/usr/local/bin/pandoc +RTS -K512m -RTS subsetCars.utf8.md --to html4 --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash+smart --output /private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpXVZFpW/mtcars20/inst/extdata/Logfiles/subsetCars.html --email-obfuscation none --self-contained --standalone --section-divs --template /Library/Frameworks/R.framework/Versions/3.5/Resources/library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable 'theme:bootstrap' --include-in-header /var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T//RtmpXVZFpW/rmarkdown-straf102acc05f9.html --mathjax --variable 'mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' 
+/usr/local/bin/pandoc +RTS -K512m -RTS subsetCars.utf8.md --to html4 --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash+smart --output /private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpdnlBey/mtcars20/inst/extdata/Logfiles/subsetCars.html --email-obfuscation none --self-contained --standalone --section-divs --template /Library/Frameworks/R.framework/Versions/3.5/Resources/library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable 'theme:bootstrap' --include-in-header /var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T//RtmpdnlBey/rmarkdown-strb4d47dc2696a.html --mathjax --variable 'mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' 
 
-Output created: /private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpXVZFpW/mtcars20/inst/extdata/Logfiles/subsetCars.html
-INFO [2018-07-09 09:24:59] 1 required data objects created by subsetCars.Rmd
-INFO [2018-07-09 09:24:59] Saving to data
-INFO [2018-07-09 09:24:59] Copied documentation to /private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpXVZFpW/mtcars20/R/mtcars20.R
+Output created: /private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpdnlBey/mtcars20/inst/extdata/Logfiles/subsetCars.html
+INFO [2018-07-09 09:38:47] 1 required data objects created by subsetCars.Rmd
+INFO [2018-07-09 09:38:47] Saving to data
+INFO [2018-07-09 09:38:47] Copied documentation to /private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpdnlBey/mtcars20/R/mtcars20.R
 ✔ Creating 'vignettes/'
 ✔ Creating 'inst/doc/'
-INFO [2018-07-09 09:24:59] Done
-INFO [2018-07-09 09:24:59] DataPackageR succeeded
-INFO [2018-07-09 09:24:59] Building documentation
+INFO [2018-07-09 09:38:47] Done
+INFO [2018-07-09 09:38:47] DataPackageR succeeded
+INFO [2018-07-09 09:38:47] Building documentation
 First time using roxygen2. Upgrading automatically...
-Updating roxygen version in /private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpXVZFpW/mtcars20/DESCRIPTION
+Updating roxygen version in /private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpdnlBey/mtcars20/DESCRIPTION
 Writing NAMESPACE
 Writing mtcars20.Rd
 Writing cars_over_20.Rd
-INFO [2018-07-09 09:24:59] Building package
+INFO [2018-07-09 09:38:47] Building package
 '/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file  \
   --no-environ --no-save --no-restore --quiet CMD build  \
-  '/private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpXVZFpW/mtcars20'  \
+  '/private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpdnlBey/mtcars20'  \
   --no-resave-data --no-manual --no-build-vignettes 
 
-[1] "/private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpXVZFpW/mtcars20_1.0.tar.gz"
+[1] "/private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpdnlBey/mtcars20_1.0.tar.gz"

Why not just use R CMD build?

If the processing script is time consuming or the data set is particularly large, then R CMD build would run the code each time the package is installed. In such cases, raw data may not be available, or the environment to do the data processing may not be set up for each user of the data. DataPackageR decouples data processing from package building/installation for data consumers.

@@ -559,23 +558,21 @@

Using the DataVersion

Partial builds and migrating old data packages.

Version 1.12.0 has moved away from controlling the build process using datasets.R and an additional masterfile argument.

-

The build process is now controlled via a datapackager.yml configuration file located in the package root directory. (see YAML Configuration Details)

+

The build process is now controlled via a datapackager.yml configuration file located in the package root directory. (see YAML Configuration Details)

You can migrate an old package by constructing such a config file using the construct_yml_config() API.

+ enabled: yes + file2.R: + enabled: yes + objects: + - object1 + - object2 + render_root: + tmp: '378263'

config is a newly constructed yaml configuration object. It can be written to the package directory:

@@ -589,16 +586,14 @@

Partial builds

configuration: files: file1.Rmd: - name: file1.Rmd - enabled: yes - file2.R: - name: file2.R - enabled: no - objects: - - object1 - - object2 - render_root: - tmp: '141841'
+ enabled: yes + file2.R: + enabled: no + objects: + - object1 + - object2 + render_root: + tmp: '378263'

Note that the modified configuration needs to be written back to the package source directory in order for the changes to take effect.

The consequence of toggling a file to enable: no is that it will be skipped when the package is rebuilt, but the data will still be retained in the package, and the documentation will not be altered.

This is useful in situations where we have multiple data sets, and want to re-run one script to update a specific data set, but not the other scripts because they may be too time consuming, for example.

diff --git a/vignettes/usingDataPackageR.md b/vignettes/usingDataPackageR.md index 5add8a9..9196858 100644 --- a/vignettes/usingDataPackageR.md +++ b/vignettes/usingDataPackageR.md @@ -70,7 +70,7 @@ Creating Read-and-delete-me ... Saving functions and data ... Making help files ... Done. -Further steps are described in '/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T//RtmpXVZFpW/mtcars20/Read-and-delete-me'. +Further steps are described in '/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T//RtmpdnlBey/mtcars20/Read-and-delete-me'. Adding DataVersion string to DESCRIPTION Creating data and data-raw directories configuring yaml file @@ -115,11 +115,10 @@ The contents are: configuration: files: subsetCars.Rmd: - name: subsetCars.Rmd enabled: yes objects: cars_over_20 render_root: - tmp: '694862' + tmp: '158965' ``` The two main pieces of information in the configuration are a list of the files to be processed and the data sets the package will store. @@ -132,7 +131,7 @@ The objects must be listed in the yaml configuration file. `datapackage_skeleton DataPackageR provides an API for modifying this file, so it does not need to be done by hand. -Further information on the contents of the YAML configuration file, and the API are in the [YAML Configuration Details](YAML_CONFIG.html) +Further information on the contents of the YAML configuration file, and the API are in the [YAML Configuration Details](YAML_CONFIG.md) ### Where do I put raw data? @@ -144,9 +143,9 @@ In this example we are reading from `data(mtcars)` rather than from the file sys To locate the data to read from the filesystem: -- `DataPackageR::project_extdata_path()` to get the path to `inst/extdata` from inside an `Rmd` or `R` file. (e.g., /var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T//RtmpXVZFpW/mtcars20/inst/extdata) +- `DataPackageR::project_extdata_path()` to get the path to `inst/extdata` from inside an `Rmd` or `R` file. (e.g., /var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T//RtmpdnlBey/mtcars20/inst/extdata) -- `DataPackageR::project_path()` to get the path to the datapackage root. (e.g., /var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T//RtmpXVZFpW/mtcars20) +- `DataPackageR::project_path()` to get the path to the datapackage root. (e.g., /var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T//RtmpdnlBey/mtcars20) Raw data stored externally can be retreived relative to these paths. @@ -160,36 +159,36 @@ Once the skeleton framework is set up, # Run the preprocessing code to build cars_over_20 # and reproducibly enclose it in a package. DataPackageR:::package_build(file.path(tempdir(),"mtcars20")) -INFO [2018-07-09 09:24:58] Logging to /private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpXVZFpW/mtcars20/inst/extdata/Logfiles/processing.log -INFO [2018-07-09 09:24:58] Processing data -INFO [2018-07-09 09:24:58] Reading yaml configuration -INFO [2018-07-09 09:24:58] Found /private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpXVZFpW/mtcars20/data-raw/subsetCars.Rmd -INFO [2018-07-09 09:24:58] Processing 1 of 1: /private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpXVZFpW/mtcars20/data-raw/subsetCars.Rmd +INFO [2018-07-09 09:38:47] Logging to /private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpdnlBey/mtcars20/inst/extdata/Logfiles/processing.log +INFO [2018-07-09 09:38:47] Processing data +INFO [2018-07-09 09:38:47] Reading yaml configuration +INFO [2018-07-09 09:38:47] Found /private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpdnlBey/mtcars20/data-raw/subsetCars.Rmd +INFO [2018-07-09 09:38:47] Processing 1 of 1: /private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpdnlBey/mtcars20/data-raw/subsetCars.Rmd processing file: subsetCars.Rmd output file: subsetCars.knit.md -/usr/local/bin/pandoc +RTS -K512m -RTS subsetCars.utf8.md --to html4 --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash+smart --output /private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpXVZFpW/mtcars20/inst/extdata/Logfiles/subsetCars.html --email-obfuscation none --self-contained --standalone --section-divs --template /Library/Frameworks/R.framework/Versions/3.5/Resources/library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable 'theme:bootstrap' --include-in-header /var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T//RtmpXVZFpW/rmarkdown-straf102acc05f9.html --mathjax --variable 'mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' +/usr/local/bin/pandoc +RTS -K512m -RTS subsetCars.utf8.md --to html4 --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash+smart --output /private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpdnlBey/mtcars20/inst/extdata/Logfiles/subsetCars.html --email-obfuscation none --self-contained --standalone --section-divs --template /Library/Frameworks/R.framework/Versions/3.5/Resources/library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable 'theme:bootstrap' --include-in-header /var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T//RtmpdnlBey/rmarkdown-strb4d47dc2696a.html --mathjax --variable 'mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' -Output created: /private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpXVZFpW/mtcars20/inst/extdata/Logfiles/subsetCars.html -INFO [2018-07-09 09:24:59] 1 required data objects created by subsetCars.Rmd -INFO [2018-07-09 09:24:59] Saving to data -INFO [2018-07-09 09:24:59] Copied documentation to /private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpXVZFpW/mtcars20/R/mtcars20.R +Output created: /private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpdnlBey/mtcars20/inst/extdata/Logfiles/subsetCars.html +INFO [2018-07-09 09:38:47] 1 required data objects created by subsetCars.Rmd +INFO [2018-07-09 09:38:47] Saving to data +INFO [2018-07-09 09:38:47] Copied documentation to /private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpdnlBey/mtcars20/R/mtcars20.R ✔ Creating 'vignettes/' ✔ Creating 'inst/doc/' -INFO [2018-07-09 09:24:59] Done -INFO [2018-07-09 09:24:59] DataPackageR succeeded -INFO [2018-07-09 09:24:59] Building documentation +INFO [2018-07-09 09:38:47] Done +INFO [2018-07-09 09:38:47] DataPackageR succeeded +INFO [2018-07-09 09:38:47] Building documentation First time using roxygen2. Upgrading automatically... -Updating roxygen version in /private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpXVZFpW/mtcars20/DESCRIPTION +Updating roxygen version in /private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpdnlBey/mtcars20/DESCRIPTION Writing NAMESPACE Writing mtcars20.Rd Writing cars_over_20.Rd -INFO [2018-07-09 09:24:59] Building package +INFO [2018-07-09 09:38:47] Building package '/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file \ --no-environ --no-save --no-restore --quiet CMD build \ - '/private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpXVZFpW/mtcars20' \ + '/private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpdnlBey/mtcars20' \ --no-resave-data --no-manual --no-build-vignettes -[1] "/private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpXVZFpW/mtcars20_1.0.tar.gz" +[1] "/private/var/folders/jh/x0h3v3pd4dd497g3gtzsm8500000gn/T/RtmpdnlBey/mtcars20_1.0.tar.gz" ``` @@ -324,7 +323,7 @@ assert_data_version(data_package_name = "mtcars20", Version 1.12.0 has moved away from controlling the build process using `datasets.R` and an additional `masterfile` argument. -The build process is now controlled via a `datapackager.yml` configuration file located in the package root directory. (see [YAML Configuration Details](YAML_CONFIG.html)) +The build process is now controlled via a `datapackager.yml` configuration file located in the package root directory. (see [YAML Configuration Details](YAML_CONFIG.md)) You can migrate an old package by constructing such a config file using the `construct_yml_config()` API. @@ -335,16 +334,14 @@ You can migrate an old package by constructing such a config file using the `con configuration: files: file1.Rmd: - name: file1.Rmd enabled: yes file2.R: - name: file2.R enabled: yes objects: - object1 - object2 render_root: - tmp: '141841' + tmp: '378263' ``` `config` is a newly constructed yaml configuration object. It can be written to the package directory: @@ -370,16 +367,14 @@ yml_write(config, path = path_to_package) # write modified yml to the package. configuration: files: file1.Rmd: - name: file1.Rmd enabled: yes file2.R: - name: file2.R enabled: no objects: - object1 - object2 render_root: - tmp: '141841' + tmp: '378263' ``` Note that the modified configuration needs to be written back to the package source directory in order for the