From efae05c35acc361bc3e255fe9f86672dcf1b4d08 Mon Sep 17 00:00:00 2001 From: Collin Schwantes Date: Thu, 5 Sep 2024 12:15:45 -0600 Subject: [PATCH 1/2] properties must have names --- R/expand_frictionless_metadata.R | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/R/expand_frictionless_metadata.R b/R/expand_frictionless_metadata.R index 7b04b2f..d19eda7 100644 --- a/R/expand_frictionless_metadata.R +++ b/R/expand_frictionless_metadata.R @@ -67,15 +67,14 @@ expand_frictionless_metadata <- function(structural_metadata, # get property name property_to_add_name <- names(structural_metadata)[idy] property_to_add_value <- y + names(property_to_add_value) <- property_to_add_name # overwrite properties that already exist if(property_to_add_name %in% names(x)){ x[property_to_add_name] <- property_to_add_value next() } - - - names(property_to_add_value) <- property_to_add_name + # add new property x <- c(x, property_to_add_value) } From 373929c4bee5f16f68cc41fa1995ac3fca0dd701 Mon Sep 17 00:00:00 2001 From: Collin Schwantes Date: Thu, 5 Sep 2024 12:21:22 -0600 Subject: [PATCH 2/2] add demonstration of updating structural metadata --- vignettes/data_examples/my_data.csv | 20 ++++++++++---------- vignettes/metadata.Rmd | 12 +++++++++--- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/vignettes/data_examples/my_data.csv b/vignettes/data_examples/my_data.csv index ddcc193..8846be9 100644 --- a/vignettes/data_examples/my_data.csv +++ b/vignettes/data_examples/my_data.csv @@ -1,11 +1,11 @@ "date","measurement","measured_by","site_name","key" -2024-08-26,20,"Johana","b",1 -2024-08-27,13,"Johana","c",2 -2024-08-28,51,"Collin","b",3 -2024-08-29,14,"Collin","b",4 -2024-08-30,19,"Collin","c",5 -2024-08-31,29,"Johana","d",6 -2024-09-01,2,"Johana","d",7 -2024-09-02,88,"Collin","a",8 -2024-09-03,21,"Johana","d",9 -2024-09-04,25,"Johana","c",10 +2024-08-26,43,"Johana","c",1 +2024-08-27,9,"Johana","c",2 +2024-08-28,79,"Johana","c",3 +2024-08-29,17,"Collin","a",4 +2024-08-30,61,"Johana","e",5 +2024-08-31,30,"Collin","b",6 +2024-09-01,58,"Collin","a",7 +2024-09-02,27,"Johana","d",8 +2024-09-03,52,"Johana","d",9 +2024-09-04,82,"Collin","e",10 diff --git a/vignettes/metadata.Rmd b/vignettes/metadata.Rmd index 49a0a62..e1dc9c9 100644 --- a/vignettes/metadata.Rmd +++ b/vignettes/metadata.Rmd @@ -186,9 +186,6 @@ expand_frictionless_metadata(structural_metadata = structural_metadata, data_package_path = "data_examples/datapackage.json") -# update the deposit the new structural metadata -cli$deposit_update() - ## OOPs actually I need to add more to the description @@ -209,6 +206,15 @@ cli$deposit_fill_metadata(descriptive_metadata) # upload to zenodo - this creates a **draft** deposit in Zenodo cli$deposit_upload_file(path = "data_examples/") +## update structural metadata + +structural_metadata[1,2] <- "New description" + +expand_frictionless_metadata(structural_metadata = structural_metadata, + resource_name = "my_data", # name of the file with no extension + resource_path = "data_examples/my_data.csv", + data_package_path = "data_examples/datapackage.json") + # there are methods for embargoing or restricting deposits in {deposits}