goose_loop_me: Convert Code to Loop Structure

View source: R/goose_essentials.R

goose_loop_meR Documentation

Convert Code to Loop Structure

Description

Takes a script or code block and converts it to an efficient loop structure based on the specified iteration requirements.

Usage

goose_loop_me(code, loop_over, iterator_name = "i", parallel = FALSE)

Arguments

code

Character string or file path containing the code to loop

loop_over

What to loop over (e.g., "files", "columns", "rows", "list elements")

iterator_name

Name for the loop variable (default: "i")

parallel

Whether to use parallel processing (default: FALSE)

Value

Modified code with loop structure

Examples

## Not run: 
# Convert file processing to loop
code <- "data <- read.csv('file.csv')\nsummary(data)"
goose_loop_me(code, loop_over = "files")

# Create parallel loop
goose_loop_me("process_data(df)", loop_over = "datasets", parallel = TRUE)

## End(Not run)


gooseR documentation built on Feb. 6, 2026, 5:07 p.m.