Skip to content

Commit

Permalink
add param version
Browse files Browse the repository at this point in the history
  • Loading branch information
sannegovaert committed Aug 27, 2024
1 parent 4a48d26 commit 85e97f4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
15 changes: 12 additions & 3 deletions R/example_package.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,23 @@
#' `"path": ["observations_1.tsv", "observations_2.tsv"]`.
#' 3. `media`: inline data stored in `data`.
#'
#' @param version Version of the [Data Package](
#' https://datapackage.org/blog/2024-06-26-v2-release/) standard that this
#' example Data Package uses. Currently only version 1 is supported.
#' @return A Data Package object, see [create_package()].
#' @family sample data
#' @export
#' @examples
#' example_package()
example_package <- function() {
path <- system.file(
"extdata", "v1", "datapackage.json", package = "frictionless"
example_package <- function(version = 1) {
if (!version %in% c(1, "1", 1.0, "1.0")) {
cli::cli_abort(
"Currently only version 1 is supported."
)

Check warning on line 24 in R/example_package.R

View check run for this annotation

Codecov / codecov/patch

R/example_package.R#L22-L24

Added lines #L22 - L24 were not covered by tests
} else {
path <- system.file(
"extdata", "v1", "datapackage.json", package = "frictionless"
)
}
read_package(path)
}
6 changes: 5 additions & 1 deletion man/example_package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 85e97f4

Please sign in to comment.