Learn R Programming

chores

The chores package provides a library of ergonomic LLM assistants designed to help you complete repetitive, hard-to-automate tasks quickly. After selecting some code, press the keyboard shortcut you’ve chosen to trigger the chores addin (we suggest Ctrl+Cmd+C), select the helper, and watch your code be rewritten.

Installation

Getting started with chores takes three steps.

1) Install the chores package like so:

install.packages("chores")

You can install the developmental version with:

pak::pak("simonpcouch/chores")

2) Then, you need to configure chores with an ellmer model. chores uses ellmer under the hood, so any model that you can chat with through ellmer is also supported by chores. To configure chores with ellmer, set the option .chores_chat to any ellmer Chat. For example, to use Claude, you’d write options(.chores_chat = ellmer::chat_claude()), possibly in your .Rprofile so that chores is ready to go every time you start R. To learn more, see the Getting started with chores vignette.

3) Chore helpers are interfaced with the via the chores addin. For easiest access, we recommend registering the chores addin to a keyboard shortcut.

In RStudio, navigate to Tools > Modify Keyboard Shortcuts > Search "Chores"—we suggest Ctrl+Alt+C (or Ctrl+Cmd+C on macOS).

In Positron, you’ll need to open the command palette, run “Open Keyboard Shortcuts (JSON)”, and paste the following into your keybindings.json:

    {
        "key": "Ctrl+Cmd+C",
        "command": "workbench.action.executeCode.console",
        "when": "editorTextFocus",
        "args": {
            "langId": "r",
            "code": "chores::.init_addin()",
            "focus": true
        }
    }

The analogous keybinding on non-macOS is Ctrl+Alt+C. That said, change the "key" entry to any keybinding you wish!

Once those steps are completed, you’re ready to use helpers with a keyboard shortcut.

Example

Chore helpers are created automatically when users interact with the chores addin. Just highlight some code, open the addin, begin typing the “chore” of your chores and press “Return”, and watch your code be rewritten:

As-is, the package provides ergonomic LLM assistants for R package development:

Users have also contributed a number of helpers for a wide range of tasks–see vignette("gallery", package = "chores") for a gallery of user-contributed helpers!

That said, all you need to create your own chore helper is a markdown file with some instructions on how you’d like it to work. See prompt_new() and directory_load() for more information, and palpable for an example chores extension package.

How much do helpers cost?

The cost of using helpers depends on 1) the length of the underlying prompt for a given helper and 2) the cost per token of the chosen model. Using the cli helper with Anthropic’s Claude Sonnet 3.5, for example, costs something like $15 per 1,000 code refactorings, while using the testthat helper with OpenAI’s GPT 4o-mini would cost something like $1 per 1,000 refactorings. Chore helpers using a locally-served LLM are “free” (in the usual sense of code execution, ignoring the cost of increased battery usage).

Copy Link

Version

Install

install.packages('chores')

Version

0.1.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Simon Couch

Last Published

February 21st, 2025

Functions in chores (0.1.0)

directory

The prompt directory
cli_helper

The cli helper
testthat_helper

The testthat helper
.init_addin

Run the chores addin
roxygen_helper

The roxygen helper
helper_options

Options used by the chores package
prompt

Working with helper prompts
.init_helper

Initialize a Helper object
chores-package

chores: A Collection of Large Language Model Assistants