Skip to content

Commit

Permalink
add labels to column mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
Spinner committed Jan 8, 2025
1 parent c55ac67 commit 04663bc
Show file tree
Hide file tree
Showing 4 changed files with 448 additions and 164 deletions.
29 changes: 29 additions & 0 deletions R/label_operators.R
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,32 @@ set_empty_label <- function(x) {
}
return(x)
}

#' Get the Label of a Heading
#'
#' This function retrieves the label of a heading from a labels file.
#'
#' @param variable The variable for which the label is to be retrieved.
#'
#' @return The label of the heading if it exists in the labels file,
#' otherwise "No label available".
#'
#' @examples
#' \dontrun{
#' # Example usage:
#' labels_file <- data.frame(
#' Variable = c("USUBJID", "AVAL"),
#' Label = c("Unique Subject Identifier", "Analysis Value")
#' )
#' get_label("USUBJID") # Returns "Unique Subject Identifier"
#' get_label("AGE") # Returns "No label available"
#' }
#'
#' @export
get_label <- function(variable) {
label <- unique(labels_file$Label[labels_file$Variable == variable])
if (length(label) == 0) {
return("No label available")
}
return(label)
}
2 changes: 2 additions & 0 deletions inst/shiny/global.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
source("modules/tab_data.R")
#Load labels
labels_file <- read.csv(system.file("shiny/data/adnca_labels.csv", package = "aNCA"))

source("modules/slope_selector.R")

Expand Down
Loading

0 comments on commit 04663bc

Please sign in to comment.