-
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.
- Loading branch information
Showing
12 changed files
with
122 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# #' Aggregate _metadata.yml | ||
# #' | ||
# #' For use within a qmd-file to obtain list parameters from _metadata.yml-files in the subfolders. | ||
# #' Parameters are inherited and updated from parent to child folders. | ||
# #' | ||
# #' @export | ||
# #' | ||
# aggregate_metadata_yml <- function() { | ||
# # Get the current input directory | ||
# current_dir <- knitr::current_input(dir = TRUE) |> fs::path_dir() | ||
|
||
# # Initialize an empty list to store metadata | ||
# aggregated_metadata <- list() | ||
|
||
# # Traverse up the directory hierarchy until no _metadata.yml is found | ||
# dirs <- list() | ||
# tmp <- current_dir | ||
# while (TRUE) { | ||
# metadata_file <- fs::path(tmp, "_metadata.yml") | ||
|
||
# if (fs::file_exists(metadata_file)) { | ||
# dirs <- c(tmp, dirs) | ||
# } else { | ||
# break | ||
# } | ||
|
||
# parent_folder <- fs::path(tmp, "..") |> fs::path_norm() | ||
|
||
# # Stop if the parent folder is the same as the current folder (root reached) | ||
# if (tmp == parent_folder) { | ||
# break | ||
# } | ||
|
||
# tmp <- parent_folder | ||
# } | ||
|
||
# # Traverse from the upper-most directory downward | ||
# for (dir in dirs) { | ||
# metadata_file <- fs::path(dir, "_metadata.yml") | ||
|
||
# if (fs::file_exists(metadata_file)) { | ||
# # Read the metadata and merge it into the aggregated metadata | ||
# metadata_content <- yaml::read_yaml(metadata_file) | ||
# aggregated_metadata <- utils::modifyList(aggregated_metadata, metadata_content) | ||
# } | ||
# } | ||
|
||
# return(aggregated_metadata) | ||
# } | ||
|
||
# aggregate_metadata_yaml <- aggregate_metadata_yml |
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,15 @@ | ||
check_no_duplicated_label_suffix <- function(data_summary, error_on_duplicates = TRUE) { | ||
duplicates <- | ||
data_summary |> | ||
dplyr::grouped_df(vars = c(".variable_label")) |> | ||
dplyr::filter(dplyr::n_distinct(.data[[".variable_name"]], na.rm = FALSE) > 1) |> | ||
dplyr::ungroup() | ||
if (nrow(duplicates) > 0 && !all(is.na(duplicates[[".variable_label"]]))) { | ||
msg <- "Found duplicated variable labels: {unique(duplicates[['.variable_label']])}" | ||
if (isTRUE(error_on_duplicates)) { | ||
cli::cli_abort(msg) | ||
} else { | ||
cli::cli_warn(msg) | ||
} | ||
} | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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