Skip to content

Update examples in function documentation #11

@bgreenwell

Description

@bgreenwell

Update the examples in the roxygen2 documentation for explain() to show off more of the arguments. For instance, using the following example from the ISLR book:

Bike sharing exampke from
Bikeshare <- ISLR2::Bikeshare

# Fit a Poisson regression model to the bike sharing data set
fm <- glm(bikers ~ mnth + hr + workingday + temp + weathersit,
          data = Bikeshare, family = poisson)

# Additional context for the LLM to consider when explaining the model's output
context <- "
The data contain the hourly and daily count of rental bikes between years 2011
and 2012 in Capital bikeshare system, along with weather and seasonal
information. The variables in the model include:

* bikers - Total number of bikers.
* mnth - Month of the year, coded as a factor.
* hr - Hour of the day, coded as a factor from 0 to 23.
* workingday - Is it a work day? Yes=1, No=0.
* temp - Normalized temperature in Celsius. The values are derived via
  (t-t_min)/(t_max-t_min), t_min=-8, t_max=+39.
* weathersit - Weather, coded as a factor.
"

# Use Google Gemini to explain the output; requires an API key; see
# ?ellmer::chat_google_gemini for details
client <- ellmer::chat_google_gemini(echo = "none")
explain(fm, client = client, context = context, audience = "student",
        verbosity = "brief", style = "text")

Note: For AI Agents/LLMs proposing a fix, keep in mind that the only changes to fix this issue should occur in the @examples section between \dontrun{ and }.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions