From 72abf29e25ff9c4bc53e569a1ad215bd544757d6 Mon Sep 17 00:00:00 2001 From: go_gonzo Date: Fri, 10 Nov 2023 08:28:58 +0100 Subject: [PATCH] @kartikayakirar --- R/utils.R | 21 ++++++++++++++++++++- man/check_filter_datanames.Rd | 21 +++++++++++++++++++++ man/check_modules_datanames.Rd | 21 +++++++++++++++++++++ 3 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 man/check_filter_datanames.Rd create mode 100644 man/check_modules_datanames.Rd diff --git a/R/utils.R b/R/utils.R index 05c5d578b7..3b5cd9d913 100644 --- a/R/utils.R +++ b/R/utils.R @@ -141,6 +141,16 @@ resolve_modules_datanames <- function(modules, datanames, join_keys) { } } +#' Check `datanames` in modules +#' +#' This function ensures specified `datanames` in modules match those in the data object, +#' returning error messages or `TRUE` for successful validation. +#' +#' @param modules (`teal_modules`) object +#' @param datanames (`character`) names of datasets available in the `data` object +#' +#' @return A `character(1)` containing error message or `TRUE` if validation passes. +#' @keywords internal check_modules_datanames <- function(modules, datanames) { recursive_check_datanames <- function(modules, datanames) { # check teal_modules against datanames @@ -166,7 +176,16 @@ check_modules_datanames <- function(modules, datanames) { } } - +#' Check `datanames` in filters +#' +#' This function check `datanames` in filters correspond to those in `data`, +#' returning character vector with error messages or TRUE if all checks pass. +#' +#' @param filters (`teal_slices`) object +#' @param datanames (`character`) names of datasets available in the `data` object +#' +#' @return A `character(1)` containing error message or TRUE if validation passes. +#' @keywords internal check_filter_datanames <- function(filters, datanames) { # check teal_slices against datanames out <- sapply( diff --git a/man/check_filter_datanames.Rd b/man/check_filter_datanames.Rd new file mode 100644 index 0000000000..e4e46e8c16 --- /dev/null +++ b/man/check_filter_datanames.Rd @@ -0,0 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/utils.R +\name{check_filter_datanames} +\alias{check_filter_datanames} +\title{Check \code{datanames} in filters} +\usage{ +check_filter_datanames(filters, datanames) +} +\arguments{ +\item{filters}{(\code{teal_slices}) object} + +\item{datanames}{(\code{character}) names of datasets available in the \code{data} object} +} +\value{ +A \code{character(1)} containing error message or TRUE if validation passes. +} +\description{ +This function check \code{datanames} in filters correspond to those in \code{data}, +returning character vector with error messages or TRUE if all checks pass. +} +\keyword{internal} diff --git a/man/check_modules_datanames.Rd b/man/check_modules_datanames.Rd new file mode 100644 index 0000000000..7fef35aec0 --- /dev/null +++ b/man/check_modules_datanames.Rd @@ -0,0 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/utils.R +\name{check_modules_datanames} +\alias{check_modules_datanames} +\title{Check \code{datanames} in modules} +\usage{ +check_modules_datanames(modules, datanames) +} +\arguments{ +\item{modules}{(\code{teal_modules}) object} + +\item{datanames}{(\code{character}) names of datasets available in the \code{data} object} +} +\value{ +A \code{character(1)} containing error message or \code{TRUE} if validation passes. +} +\description{ +This function ensures specified \code{datanames} in modules match those in the data object, +returning error messages or \code{TRUE} for successful validation. +} +\keyword{internal}