stratified_custom_labels {stratifiedyh}R Documentation

Stratify and Assign Custom Labels to Data

Description

This function stratifies data based on a specified grouping column and assigns custom labels according to a given percentage.

Usage

stratified_custom_labels(df, group_col, label_percentage, label1, label2)

Arguments

df

A data frame to be stratified.

group_col

A character string specifying the column name to group by.

label_percentage

A numeric value between 0 and 100 indicating the percentage of the first label to assign within each group.

label1

A character string representing the first label.

label2

A character string representing the second label.

Value

A data frame with an additional column "Custom_Labels" containing the stratified custom labels.

Examples

result <- stratified_custom_labels(iris, group_col = "Species",
                                   label_percentage = 50,
                                   label1 = "High", label2 = "Low")

[Package stratifiedyh version 0.1.0 Index]