Learn R Programming

sdcMicro (version 5.8.0)

clean_llm_code: Clean LLM-generated R code

Description

Replaces literal '\n' with real line breaks, trims whitespace, and optionally indents.

Usage

clean_llm_code(code_string, indent = FALSE)

Value

Cleaned R code as a single string.

Arguments

code_string

Character string returned by LLM (with '\n' line breaks).

indent

Logical, whether to indent lines (for printing only).