Sign in

George Stagg

@gws.phd
2.4K followers 222 following 25 posts

Software Engineer @ Posit working on Open Source & AI. Maths. Physics. I like making things.

PostsRepliesMedia
George Stagg @gws.phd · 28/04/2026
This week's #TidyTuesday is about agricultural tariffs in the US. Today I've been working some more on #ggsql, so here is a ggsql plot! Code: gist.github.com/georgestagg/...
Distribution of US Agricultural Tariff Rates

Rates at time of introduction, by 5-year period and HTS product section

Source: USITC Tariff Database

Around 2015, high initial rates from DR-CAFTA, Korea, Colombia & Peru FTAs all overlap before declining
0133
George Stagg @gws.phd · 21/04/2026
Yesterday we announced the alpha release of #ggsql 🎉 In celebration, here is a ggsql plot for #TidyTuesday Week 16 of 2026, using a dataset on global health spending! 💰 ggsql source: gist.github.com/georgestagg/...
A plot showing out-of-pocket payments as a percent of total health spending for many countries over time. Countries are grouped using 2022 World Bank income classifications. Reliance on out-of-pocket payments for health care is falling, but many countries still face heavy burdens
0122
George Stagg @gws.phd · 04/01/2025
Recently I've been working on getting #polars running in #pyodide. This was a fun one, even requiring patches to LLVM's #wasm writer! Everything has now been upstreamed and earlier this week Pyodide v0.27.0 released, including a Wasm build of Polars usable in Pyodide, Shinylive and Quarto Live 🎉
A screenshot of a Pyodide REPL executing Polars code:

import polars as pl
import requests
r = requests.get("https://raw.githubusercontent.com/pola-rs/polars/refs/heads/main/examples/datasets/foods2.csv")
pl.read_csv(r.content).group_by("category").mean()A screenshot of a Quarto Live code cell executing Polars code:

import polars as pl
import requests
r = requests.get("https://raw.githubusercontent.com/pola-rs/polars/refs/heads/main/examples/datasets/foods2.csv")
pl.read_csv(r.content).group_by("category").mean()A screenshot of a Shinylive app using Polars code:

from shiny import App, render, ui
import polars as pl
from pathlib import Path

app_ui = ui.page_fluid(
    ui.input_select("cyl", "Select Cylinders", choices=["4", "6", "8"]),
    ui.output_data_frame("filtered_data")
)

def server(input, output, session):
    df = pl.read_csv(Path(__file__).parent / "mtcars.csv")
    
    @output
    @render.data_frame
    def filtered_data():
        return (df
                .filter(pl.col("cyl") == int(input.cyl()))
                .select(["mpg", "cyl", "hp"]))

app = App(app_ui, server)
0499
George Stagg @gws.phd · 14/03/2024
I recently wrote a deep-dive post discussing the patches we make to LLVM Flang to cross-compile #wasm objects from Fortran source for #webR. It's at gws.phd/posts/fortra..., do take a look if you're interested. There are also some fun little interactive BLAS & LAPACK demos near the end of the post.
A screenshot of a demo app consisting of a box on the left and a histogram on the right.

The digit 4 has been hand-written into the box on the left (e.g. with a mouse or touchscreen).

The histogram shows a probability distribution over the digits 0-9, attempting to classify which digit has been drawn. In this case, the bar for the digit "4" is the highest.
021