generate_caption: Helper function to generate a caption string based on...

View source: R/helpers.R

generate_captionR Documentation

Helper function to generate a caption string based on provided attributes

Description

Generates a caption string based on provided attributes.

Usage

generate_caption(attributes)

Arguments

attributes

A list containing various attributes that may include dimension, num_steps, mu, and sd.

Details

This function is useful for creating descriptive captions for plots or outputs based on the attributes provided. It ensures that only non-null attributes are included in the caption. This function constructs a caption string by checking various attributes provided in a list. It formats the caption based on the presence of specific attributes, such as dimensions, number of steps, and statistical parameters like mu and standard deviation (sd).

Value

A character string representing the generated caption. If no attributes are provided, it returns an empty string.

Author(s)

Antti Lennart Rask

See Also

Other Utility Functions: convert_snake_to_title_case(), get_attributes(), rand_walk_helper(), running_quantile(), std_cum_max_augment(), std_cum_mean_augment(), std_cum_min_augment(), std_cum_prod_augment(), std_cum_sum_augment()

Examples

attrs <- list(dimension = 3, num_steps = 100, mu = 0.5, sd = 1.2)
generate_caption(attrs) # "3 dimensions, 100 steps, mu = 0.5, sd = 1.2."

attrs <- list(dimension = NULL, num_steps = 50, mu = NULL, sd = 2.0)
generate_caption(attrs) # "50 steps, sd = 2.0."


RandomWalker documentation built on Oct. 23, 2024, 5:07 p.m.