stratified_labels {stratifiedyh}R Documentation

Stratify and Assign Labels to Data

Description

This function stratifies data based on a specified grouping column and assigns "Yes" or "No" labels according to a given percentage.

Usage

stratified_labels(df, group_col, yes_percentage)

Arguments

df

A data frame to be stratified.

group_col

A character string specifying the column name to group by.

yes_percentage

A numeric value between 0 and 100 indicating the percentage of "Yes" labels to assign within each group.

Value

A data frame with an additional column "Sampled_Yes_No" containing the stratified "Yes"/"No" labels.

Examples

# Example with the iris dataset
result <- stratified_labels(iris, group_col = "Species", yes_percentage = 50)

[Package stratifiedyh version 0.1.0 Index]