From 4ed9a3d8cffd0db37a9fc8b7e24cab65c53b0e40 Mon Sep 17 00:00:00 2001 From: Kalash Singhal <125359076+kalashsinghal@users.noreply.github.com> Date: Tue, 4 Jun 2024 13:59:12 +0200 Subject: [PATCH] Export `categorize_risk` function (#793) * export categorize risk function * update documentation --- NAMESPACE | 1 + R/utils.R | 4 ++++ man/categorize_risk.Rd | 12 ++++++++++++ 3 files changed, 17 insertions(+) create mode 100644 man/categorize_risk.Rd diff --git a/NAMESPACE b/NAMESPACE index c286ecaf..73f7c34b 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -13,6 +13,7 @@ export(.data) export(aka) export(as_label) export(as_name) +export(categorize_risk) export(document_default_value) export(document_tilt_profile) export(emissions_profile) diff --git a/R/utils.R b/R/utils.R index 65254753..1f5a8fe1 100644 --- a/R/utils.R +++ b/R/utils.R @@ -14,6 +14,10 @@ risk_category_levels <- function() { c("high", "medium", "low") } +#' Categorize a variable into risk categories using low and high thresholds +#' +#' @keywords internal +#' @export categorize_risk <- function(x, low_threshold, high_threshold, ...) { case_when( x > high_threshold ~ "high", diff --git a/man/categorize_risk.Rd b/man/categorize_risk.Rd new file mode 100644 index 00000000..82069537 --- /dev/null +++ b/man/categorize_risk.Rd @@ -0,0 +1,12 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/utils.R +\name{categorize_risk} +\alias{categorize_risk} +\title{Categorize a variable into risk categories using low and high thresholds} +\usage{ +categorize_risk(x, low_threshold, high_threshold, ...) +} +\description{ +Categorize a variable into risk categories using low and high thresholds +} +\keyword{internal}