goose_review_code: Review R Code with AI

View source: R/ai_assistant.R

goose_review_codeR Documentation

Review R Code with AI

Description

Get AI-powered code review and suggestions for improvement.

Usage

goose_review_code(
  code,
  focus = c("performance", "style", "bugs", "documentation"),
  context = NULL,
  detailed = TRUE
)

Arguments

code

Character string or function containing R code to review

focus

Character vector of focus areas (e.g., "performance", "style", "bugs")

context

Optional context about the code's purpose

detailed

Logical, whether to request detailed analysis

Value

List with review results including suggestions, issues, and improvements

Examples

## Not run: 
# Review a function
my_func <- function(x) {
  for(i in 1:length(x)) {
    x[i] <- x[i] * 2
  }
  return(x)
}
review <- goose_review_code(my_func, focus = c("performance", "style"))

# Review code string
code <- "df$new_col = df$col1 + df$col2"
review <- goose_review_code(code, context = "Adding columns in data frame")

## End(Not run)

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