Skip to content

Instantly share code, notes, and snippets.

@bastianolea
Created December 10, 2025 19:08
Show Gist options
  • Select an option

  • Save bastianolea/d5ebd6d3700d54f21ee2b980f12ec836 to your computer and use it in GitHub Desktop.

Select an option

Save bastianolea/d5ebd6d3700d54f21ee2b980f12ec836 to your computer and use it in GitHub Desktop.
Usar {btw} en R para crear un chat interactivo con contexto sobre el entorno de datos de R y uso de herramientas
library(dplyr)
datos <- iris |>
janitor::clean_names()
# install.packages("btw")
library(btw)
# chat normal ----
# https://ellmer.tidyverse.org/reference/Chat.html
chat <- ellmer::chat_github()
chat$chat("¿qué objetos tengo en mi entorno de R?")
# chat con herramientas y contexto, interactivo ----
# https://posit-dev.github.io/btw/reference/btw_client.html
chat <- ellmer::chat_github()
btw_app(client = chat)
# chat con herramientas y contexto, por consola ----
# https://posit-dev.github.io/btw/reference/btw_client.html
chat <- ellmer::chat_github()
chat <- btw_client(client = chat)
chat$chat("¿Qué objetos tengo en mi entorno de R?")
chat$chat("Con la base de datos que tengo cargada, ¿cómo puedo hacer un gráfico que compare los valores del ancho en cada especie?")
# configurar cliente en el RProfile ----
# usethis::edit_r_profile()
# options(btw.client = ellmer::chat_github()) |> suppressMessages()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment