R/context_roots.R

Defines functions context_roots

Documented in context_roots

#' Extract normalized contextual roots
#'
#' Returns a normalized character vector of contextual
#' roots from either:
#'
#' - a character vector of contextual roots;
#' - a named list of contextual definitions.
#'
#' The function:
#'
#' - flattens contextual roots;
#' - normalizes filesystem separators;
#' - removes trailing separators;
#' - validates uniqueness.
#'
#' This is the public interface for obtaining
#' contextual aggregation boundaries from context
#' definitions.
#'
#' @param x Character vector of contextual roots or
#'   a named list of contextual definitions.
#'
#' @return
#' A normalized character vector of unique
#' contextual roots.
#'
#' @examples
#' mini_context <- list(
#'   packages = c(
#'     "D:/packages/examplepkg",
#'     "C:/packages/examplepkg"
#'   ),
#'   research = "D:/research/projectA"
#' )
#'
#' context_roots(mini_context)
#'
#' @export

context_roots <- function(x) {
  prepare_context_roots(x)
}

Try the fscontext package in your browser

Any scripts or data that you put into this service are public.

fscontext documentation built on Nov. 19, 2026, 5:11 p.m.