No Clocks

No Clocks

2584 bookmarks
Custom sorting
Describe R Stuff to Large Language Models
Describe R Stuff to Large Language Models
Provides a number of utilities for describing R objects and package documentation in plain text. For interactive use, this is especially powerful for describing relevant pieces of context to large language models. When used programmatically, these utilities can be registered with ellmer chats as tool calls, enabling language models to peruse package documentation and explore your computational environment.
·posit-dev.github.io·
Describe R Stuff to Large Language Models
Three experiments in LLM code assist with RStudio and Positron - Tidyverse
Three experiments in LLM code assist with RStudio and Positron - Tidyverse
We've been experimenting with LLM-powered tools to streamline R data science and package development.
Twice a year, the tidyverse team sets a week aside for “spring cleaning,” bringing all of our R packages up to snuff with the most current tooling and standardizing various bits of our development process. Some of these updates can happen by calling a single function, while others are much more involved. One of those more involved updates is updating erroring code, transitioning away from base R (e.g.  stop()), rlang (e.g.  rlang::abort()), glue, and homegrown combinations of them. cli’s new syntax is easier to work with as a developer and more visually pleasing as a user.
In some cases, transitioning is almost as simple as Finding + Replacing rlang::abort() to cli::cli_abort():
# before: rlang::abort("`save_pred` can only be used if the initial results saved predictions.") # after: cli::cli_abort("{.arg save_pred} can only be used if the initial results saved predictions.")
In others, there’s a mess of ad-hoc pluralization, paste0()s, glue interpolations, and other assorted nonsense to sort through:
Thus was born clipal1, a (now-superseded) R package that allows users to select erroring code, press a keyboard shortcut, wait a moment, and watch the updated code be inlined in to the selection.
clipal was a huge boost for us in the most recent spring cleaning. Depending on the code being updated, these erroring calls used to take 30 seconds to a few minutes. With clipal, though, the model could usually get the updated code 80% or 90% of the way there in a couple seconds. Up to this point, irritated by autocomplete and frustrated by the friction of copying and pasting code and typing out the same bits of context into chats again and again, I had been relatively skeptical that LLMs could make me more productive. After using clipal for a week, though, I began to understand how seamlessly LLMs could automate the cumbersome and uninteresting parts of my work.
clipal itself is now superseded by pal, a more general solution to the problem that clipal solved. I’ve also written two additional packages like pal that solve two other classes of pal-like problems using similar tools, ensure and gander. In this post, I’ll write a bit about how I’ve used a pair of tools in three experiments that have made me much more productive as an R developer
After using clipal during our spring cleaning, I approached another spring cleaning task for the week: updating testing code. testthat 3.0.0 was released in 2020, bringing with it numerous changes that were both huge quality of life improvements for package developers and also highly breaking changes. While some of the task of converting legacy unit testing code to testthat 3e is relatively straightforward, other components can be quite tedious. Could I do the same thing for updating to testthat 3e that I did for transitioning to cli? I sloppily threw together a sister package to clipal that would convert tests for errors to snapshot tests, disentangle nested expectations, and transition from deprecated functions like ⁠expect_known_*(). ⁠(If you’re interested, the current prompt for that functionality is here.) That sister package was also a huge boost for me, but the package reused as-is almost every piece of code from clipal other than the prompt. Thus, I realized that the proper solution would provide all of this scaffolding to attach a prompt to a keyboard shortcut, but allow for an arbitrary set of prompts to help automate these wonky, cumbersome tasks.
The next week, pal was born. The pal package ships with three prompts centered on package development: the cli pal and testthat pal mentioned previously, as well as the roxygen pal, which drafts minimal roxygen documentation based on a function definition. Here’s what pal’s interface looks like now:
ensure
While deciding on the initial set of prompts that pal would include, I really wanted to include some sort of “write unit tests for this function” pal. To really address this problem, though, requires violating two of pal’s core assumptions:
All of the context that you need is in the selection and the prompt. In the case of writing unit tests, it’s actually pretty important to have other pieces of context. If a package provides some object type potato, in order to write tests for some function that takes potato as input, it’s likely very important to know how potatoes are created and the kinds of properties they have. pal’s sister package for writing unit tests, ensure, can thus “see” the rest of the file that you’re working on, as well as context from neighboring files like other .R source files, the corresponding test file, and package vignettes, to learn about how to interface with the function arguments being tested.
The LLM’s response can prefix, replace, or suffix the active selection in the same file. In the case of writing unit tests for R, the place that tests actually ought to go is in a corresponding test file in tests/testthat/. Via the RStudio API, ensure can open up the corresponding test file and write to it rather than the source file where it was triggered from.3
gander
·tidyverse.org·
Three experiments in LLM code assist with RStudio and Positron - Tidyverse
Format SQL Queries
Format SQL Queries
A convenient interface for formatting SQL queries directly within R. It acts as a wrapper around the sql_format Rust crate. The package allows you to format SQL code with customizable options, including indentation, case formatting, and more, ensuring your SQL queries are clean, readable, and consistent.
·dataupsurge.github.io·
Format SQL Queries
Packaging Your R Code
Packaging Your R Code
An overview of how usethis can help you create, develop, document and test R packages and projects
It is recommended to use the same structure in your tests/testthat/ directory as your R/ directory, i.e., a test file for every .R file.
·clarewest.github.io·
Packaging Your R Code
Design Patterns in R
Design Patterns in R
Build robust and maintainable software with object-oriented design patterns in R. Design patterns abstract and present in neat, well-defined components and interfaces the experience of many software designers and architects over many years of solving similar problems. These are solutions that have withstood the test of time with respect to re-usability, flexibility, and maintainability. R6P provides abstract base classes with examples for a few known design patterns. The patterns were selected by their applicability to analytic projects in R. Using these patterns in R projects have proven effective in dealing with the complexity that data-driven applications possess.
·tidylab.github.io·
Design Patterns in R
httr2 1.2.0 - Tidyverse
httr2 1.2.0 - Tidyverse
httr2 1.2.0 improves security for redacted headers, improves URL parsing and building, enhances debugging, and includes a bunch of other quality of life improvements.
·tidyverse.org·
httr2 1.2.0 - Tidyverse
Chapter 9 Use httptest2 | HTTP testing in R
Chapter 9 Use httptest2 | HTTP testing in R
In this chapter we aim at adding HTTP testing infrastructure to exemplighratia2 using httptest2. For this, we start from the initial state of exemplighratia2 again. Back to square one!...
·books.ropensci.org·
Chapter 9 Use httptest2 | HTTP testing in R
Welcome | Geocomputation with R
Welcome | Geocomputation with R
Welcome | Geocomputation with R is for people who want to analyze, visualize and model geographic data with open source software. It is based on R, a statistical programming language that has powerful data processing, visualization, and geospatial capabilities. The book equips you with the knowledge and skills to tackle a wide range of issues manifested in geographic data, including those with scientific, societal, and environmental implications. This book will interest people from many backgrounds, especially Geographic Information Systems (GIS) users interested in applying their domain-specific knowledge in a powerful open source language for data science, and R users interested in extending their skills to handle spatial data.
·r.geocompx.org·
Welcome | Geocomputation with R
Creating OpenAPI from HTTP Traffic
Creating OpenAPI from HTTP Traffic
Around this time of year we're thinking about things we're going to do differently, new practices we've been putting off for too long, and mistakes we want to avoid continuing into another year. For many of us in the API world, that is going to be switching to API Design-first, using standards like OpenAPI to plan and prototype the API long before any code is written. More organizations are switching to API Design-first with OpenAPI, thanks to huge efforts from tooling vendors - from the bigge
·apisyouwonthate.com·
Creating OpenAPI from HTTP Traffic
Themeable HTML components — bs_dependency
Themeable HTML components — bs_dependency
Themeable HTML components use Sass to generate CSS rules from Bootstrap Sass variables, functions, and/or mixins (i.e., stuff inside of theme). bs_dependencies() makes it a bit easier to create themeable components by compiling sass::sass() (input) together with Bootstrap Sass inside of a theme, and packaging up the result into an htmltools::htmlDependency(). Themable components can also be dynamically themed inside of Shiny (i.e., they may be themed in 'real-time' via bs_themer(), and more generally, update their styles in response to shiny::session's setCurrentTheme() method). Dynamically themeable components provide a "recipe" (i.e., a function) to bs_dependency_defer(), describing how to generate new CSS stylesheet(s) from a new theme. This function is called when the HTML page is first rendered, and may be invoked again with a new theme whenever shiny::session's setCurrentTheme() is called.
·rstudio.github.io·
Themeable HTML components — bs_dependency
Audit Shiny apps in few steps
Audit Shiny apps in few steps
Audit your Shiny apps at each commit. Multiple levels of testings are offered: startup and crash tests, performance tests (load test and global code profiling), reactivity audit as well as output tests. All results are gathered in an HTML report uploaded and available to everyone on any CI/CD plaform or RStudio Connect.
·opensource.nibr.com·
Audit Shiny apps in few steps
Master Shiny Apps: Complete R Web Development Guide
Master Shiny Apps: Complete R Web Development Guide
Master Shiny development with our comprehensive learning path covering fundamentals, UI design, server logic, advanced concepts, and production deployment. Transform from R user to professional web app developer through hands-on tutorials and real-world projects.
·datanovia.com·
Master Shiny Apps: Complete R Web Development Guide
Shiny Reactive Programming: Master Advanced Reactive Patterns
Shiny Reactive Programming: Master Advanced Reactive Patterns
Master Shiny’s reactive programming model with comprehensive coverage of reactive expressions, observers, event handling, and advanced patterns. Learn to build efficient, dynamic applications with proper reactive design.
·datanovia.com·
Shiny Reactive Programming: Master Advanced Reactive Patterns
41. Beast Mode V3
41. Beast Mode V3
41. Beast Mode V3. GitHub Gist: instantly share code, notes, and snippets.
·gist.github.com·
41. Beast Mode V3
Resident Portal
Resident Portal
·harborgroupmanagement.mriresidentconnect.com·
Resident Portal
Enterprise UI Design: Professional Bootstrap 5 for Shiny Apps
Enterprise UI Design: Professional Bootstrap 5 for Shiny Apps
Master enterprise-grade UI/UX design for Shiny applications using Bootstrap 5, bslib theming, and professional design systems. Learn to create accessible, responsive interfaces that meet corporate standards for biostatistics and clinical research applications.
·datanovia.com·
Enterprise UI Design: Professional Bootstrap 5 for Shiny Apps