View source: R/goose_essentials.R
| goose_loop_me | R Documentation |
Takes a script or code block and converts it to an efficient loop structure based on the specified iteration requirements.
goose_loop_me(code, loop_over, iterator_name = "i", parallel = FALSE)
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) |
Modified code with loop structure
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.