| Title: | AI Copilot for R Analysis Workflows in 'RStudio' |
|---|---|
| Description: | An AI copilot for R users in 'RStudio' and Posit workflows with active-editor, workspace, object, console, plot, and git-aware context. Provides statistical helpers for interpreting lm() and glm() models, stages code and file actions before execution, drafts reproducible 'Quarto' content, and connects to official provider APIs or CLIs for 'OpenAI', 'GitHub Copilot', 'Gemini', and 'Anthropic'. |
| Authors: | Markuss Saule [aut, cre, cph] |
| Maintainer: | Markuss Saule <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.1 |
| Built: | 2026-06-06 06:20:20 UTC |
| Source: | https://github.com/msaule/ravel |
Execute a staged action
ravel_apply_action(action, approve = FALSE, envir = NULL)ravel_apply_action(action, approve = FALSE, envir = NULL)
action |
A |
approve |
Whether to override and treat the action as approved. |
envir |
Evaluation environment for code execution. When |
A structured result list.
Approve a staged action
ravel_approve_action(action)ravel_approve_action(action)
action |
A |
The updated action.
Report provider auth status
ravel_auth_status(provider = c("openai", "copilot", "gemini", "anthropic"))ravel_auth_status(provider = c("openai", "copilot", "gemini", "anthropic"))
provider |
Provider name. |
A named list describing auth configuration.
Launch the Ravel chat addin
ravel_chat_addin()ravel_chat_addin()
Invisibly launches a Shiny gadget.
Run one chat turn through a provider
ravel_chat_turn( prompt, provider = NULL, model = NULL, context = NULL, history = NULL )ravel_chat_turn( prompt, provider = NULL, model = NULL, context = NULL, history = NULL )
prompt |
User prompt. |
provider |
Provider name. |
model |
Optional model override. |
context |
Optional precomputed context. |
history |
Optional existing chat history. |
A list with message, actions, and raw.
Collect context for a Ravel chat turn
ravel_collect_context( include_selection = TRUE, include_file = TRUE, include_objects = TRUE, include_console = TRUE, include_plot = TRUE, include_session = TRUE, include_project = TRUE, include_git = TRUE, include_activity = TRUE, envir = NULL, max_objects = 10L )ravel_collect_context( include_selection = TRUE, include_file = TRUE, include_objects = TRUE, include_console = TRUE, include_plot = TRUE, include_session = TRUE, include_project = TRUE, include_git = TRUE, include_activity = TRUE, envir = NULL, max_objects = 10L )
include_selection |
Include the active selection. |
include_file |
Include the active file contents. |
include_objects |
Include summaries of loaded objects. |
include_console |
Include recent Ravel-managed console output. |
include_plot |
Include current plot metadata when available. |
include_session |
Include session information. |
include_project |
Include project root and file listing. |
include_git |
Include git status and diff summaries when available. |
include_activity |
Include recent Ravel action state. |
envir |
Environment used for object summaries. When |
max_objects |
Maximum number of objects to summarize. |
A named list.
Inspect local Ravel readiness
ravel_doctor()ravel_doctor()
A tibble of system and provider checks with suggested fixes.
Draft a Quarto section from analysis context
ravel_draft_quarto_section( section = c("results", "methods", "diagnostics"), model = NULL, context = NULL, include_chunk = TRUE )ravel_draft_quarto_section( section = c("results", "methods", "diagnostics"), model = NULL, context = NULL, include_chunk = TRUE )
section |
Section type. |
model |
Optional fitted model object. |
context |
Optional collected context. |
include_chunk |
Whether to include a placeholder code chunk. |
A character string containing Quarto markdown.
Get a Ravel setting
ravel_get_setting(key, default = NULL)ravel_get_setting(key, default = NULL)
key |
Setting name. |
default |
Default value when the setting is missing. |
The setting value.
Interpret a model in plain English
ravel_interpret_model(model)ravel_interpret_model(model)
model |
A fitted model object. |
A character string.
Launch an official provider login flow
ravel_launch_login( provider = c("openai", "copilot", "gemini", "anthropic"), mode = NULL )ravel_launch_login( provider = c("openai", "copilot", "gemini", "anthropic"), mode = NULL )
provider |
Provider name. |
mode |
Optional auth mode override. |
A login plan list, invisibly.
List project files for context gathering
ravel_list_project_files(root = NULL, limit = 200L)ravel_list_project_files(root = NULL, limit = 200L)
root |
Optional project root. |
limit |
Maximum number of file paths to return. |
A character vector of relative paths.
List configured providers
ravel_list_providers()ravel_list_providers()
A tibble describing the available provider adapters.
Start a provider login flow
ravel_login( provider = c("openai", "copilot", "gemini", "anthropic"), mode = NULL )ravel_login( provider = c("openai", "copilot", "gemini", "anthropic"), mode = NULL )
provider |
Provider name. |
mode |
Optional auth mode override. |
A list describing the supported login action.
Logout a provider from Ravel-managed credentials
ravel_logout(provider = c("openai", "copilot", "gemini", "anthropic"))ravel_logout(provider = c("openai", "copilot", "gemini", "anthropic"))
provider |
Provider name. |
Invisibly TRUE.
Create a new staged Ravel action
ravel_new_action(type, label, payload, provider = NULL, model = NULL)ravel_new_action(type, label, payload, provider = NULL, model = NULL)
type |
Action type. |
label |
Human-readable label. |
payload |
Action payload. |
provider |
Optional provider name. |
model |
Optional model name. |
A ravel_action object.
Open an official provider documentation or key-management page
ravel_open_provider_page( provider = c("openai", "copilot", "gemini", "anthropic"), page = c("docs", "api_keys") )ravel_open_provider_page( provider = c("openai", "copilot", "gemini", "anthropic"), page = c("docs", "api_keys") )
provider |
Provider name. |
page |
Which page to open. |
The opened URL, invisibly.
Preview generated code as a staged action
ravel_preview_code( code, label = "Run generated R code", provider = NULL, model = NULL )ravel_preview_code( code, label = "Run generated R code", provider = NULL, model = NULL )
code |
R code text. |
label |
Label for the staged action. |
provider |
Optional provider name. |
model |
Optional model name. |
A ravel_action object.
Report provider capabilities
ravel_provider_capabilities( provider = c("openai", "copilot", "gemini", "anthropic") )ravel_provider_capabilities( provider = c("openai", "copilot", "gemini", "anthropic") )
provider |
Provider name. |
A named list.
Read recent Ravel history entries
ravel_read_history(limit = 100L)ravel_read_history(limit = 100L)
limit |
Maximum number of history entries to return. |
History stays in session memory by default. To mirror it to disk explicitly,
configure options(ravel.user_dirs = list(data = "<path>")).
A tibble.
Reject a staged action
ravel_reject_action(action)ravel_reject_action(action)
action |
A |
The updated action.
Run R code with explicit approval semantics
ravel_run_code(action, approve = FALSE, envir = NULL)ravel_run_code(action, approve = FALSE, envir = NULL)
action |
Either a |
approve |
Whether to approve and run immediately. |
envir |
Evaluation environment. When |
A structured result list.
Store an API key for a provider
ravel_set_api_key( provider = c("openai", "gemini", "anthropic"), key, persist = TRUE )ravel_set_api_key( provider = c("openai", "gemini", "anthropic"), key, persist = TRUE )
provider |
Provider name. |
key |
API key value. |
persist |
Whether to try to persist the secret using |
The stored key, invisibly.
Store a bearer token for a provider
ravel_set_bearer_token(provider = c("gemini"), token, persist = TRUE)ravel_set_bearer_token(provider = c("gemini"), token, persist = TRUE)
provider |
Provider name. |
token |
Bearer token value. |
persist |
Whether to try to persist the token using |
The stored token, invisibly.
Set a Ravel setting
ravel_set_setting(key, value)ravel_set_setting(key, value)
key |
Setting name. |
value |
Setting value. |
Settings are stored in session memory by default. To mirror non-sensitive
settings to disk explicitly, configure options(ravel.user_dirs = list( config = "<path>")) before calling this function.
The written settings list, invisibly.
Launch the Ravel settings addin
ravel_settings_addin()ravel_settings_addin()
Invisibly launches a Shiny gadget.
Launch the Ravel setup assistant
ravel_setup_addin()ravel_setup_addin()
Invisibly launches a Shiny gadget.
Stage a file write action
ravel_stage_file_write( path, text, append = FALSE, provider = NULL, model = NULL )ravel_stage_file_write( path, text, append = FALSE, provider = NULL, model = NULL )
path |
Target file path. |
text |
Text to write. |
append |
Whether to append instead of overwrite. |
provider |
Optional provider name. |
model |
Optional model name. |
A ravel_action object.
Suggest diagnostics for a model
ravel_suggest_diagnostics(model)ravel_suggest_diagnostics(model)
model |
A fitted model object. |
A character vector of suggested checks.
Summarize a model object
ravel_summarize_model(model, name = NULL)ravel_summarize_model(model, name = NULL)
model |
A fitted model object. |
name |
Optional object name. |
A named list with model metadata and coefficient summaries.
Summarize an R object for provider context
ravel_summarize_object(x, name = NULL)ravel_summarize_object(x, name = NULL)
x |
An R object. |
name |
Optional object name. |
A named list.
Verify a provider with a tiny live prompt
ravel_verify_provider( provider = c("openai", "copilot", "gemini", "anthropic"), model = NULL )ravel_verify_provider( provider = c("openai", "copilot", "gemini", "anthropic"), model = NULL )
provider |
Provider name. |
model |
Optional model override. |
A named list with ok, content, provider, and model.