-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from ecohealthalliance/feature/update_friction…
…less_metadata adding update metadata function
- Loading branch information
Showing
7 changed files
with
108 additions
and
11 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#' Update descriptive metadata in frictionless datapackage | ||
#' | ||
#' This function overwrites the descriptive metadata associated with a | ||
#' frictionless datapackage. It does *NOT* validate the metadata, or check | ||
#' for conflicts with existing descriptive metadata. It is very easy to create | ||
#' invalid metadata. | ||
#' | ||
#' @param descriptive_metadata List of descriptive metadata terms. | ||
#' @param data_package_path Character. Path to datapackage.json file | ||
#' | ||
#' @return invisibly writes datapackage.json | ||
#' @export | ||
#' | ||
#' @examples | ||
#' \dontrun{ | ||
#' descriptive_metadata <- list ( | ||
#' title = "Example Dataset", | ||
#' description = "This is the abstract but it needs more detail", | ||
#' creator = list (list (name = "A. Person"), list (name = "B. Person"), | ||
#' list (name = "C. Person"),list (name = "F. Person")) | ||
#' # , accessRights = "open" | ||
#' ) | ||
#' update_frictionless_metadata(descriptive_metadata = descriptive_metadata, | ||
#' data_package_path = "data_examples/datapackage.json" | ||
#' ) | ||
#' } | ||
update_frictionless_metadata <- function(descriptive_metadata, | ||
data_package_path){ | ||
|
||
data_package <- frictionless::read_package(data_package_path) | ||
|
||
data_package_dir <- dirname(data_package_path) | ||
|
||
data_package$metadata <- descriptive_metadata | ||
|
||
# write the datapackage.json | ||
frictionless::write_package(data_package,directory = data_package_dir) | ||
|
||
invisible() | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
"date","measurement","measured_by","site_name","key" | ||
2024-08-26,29,"Johana","b",1 | ||
2024-08-27,53,"Johana","e",2 | ||
2024-08-28,71,"Johana","d",3 | ||
2024-08-29,43,"Collin","e",4 | ||
2024-08-30,93,"Johana","b",5 | ||
2024-08-31,4,"Collin","d",6 | ||
2024-09-01,74,"Johana","e",7 | ||
2024-09-02,13,"Johana","c",8 | ||
2024-09-03,46,"Johana","e",9 | ||
2024-09-04,44,"Collin","a",10 | ||
2024-08-26,38,"Collin","b",1 | ||
2024-08-27,64,"Johana","a",2 | ||
2024-08-28,94,"Johana","e",3 | ||
2024-08-29,75,"Johana","a",4 | ||
2024-08-30,49,"Collin","d",5 | ||
2024-08-31,78,"Collin","d",6 | ||
2024-09-01,93,"Johana","b",7 | ||
2024-09-02,2,"Johana","c",8 | ||
2024-09-03,91,"Johana","c",9 | ||
2024-09-04,27,"Johana","a",10 |
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