Learn R Programming

gooseR (version 0.1.2)

goose_review_code: 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
)

Value

List with review results including suggestions, issues, and improvements

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

Examples

Run this code
if (FALSE) {
# 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")
}

Run the code above in your browser using DataLab