Skip to content

Instantly share code, notes, and snippets.

library(tidyverse)
richmondway <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2023/2023-09-26/richmondway.csv')
ggplot(
richmondway,
aes(
x = (max(richmondway$Episode) + 1) * Season + Episode,
y = F_count_RK
@zjuul
zjuul / sql_data_viz.sql
Last active April 10, 2025 02:48
Data visualisation in SQL
-- this query outputs a data visualisation to explore how many unique products people
-- see on your website, and the conversion rate
-- it uses Big Query SQL on a GA4Dataform events table - check https://github.com/superformlabs/ga4dataform-community
with products_per_user as (
SELECT
user_pseudo_id,
count( distinct if(event_name = 'view_item', i.item_name, NULL) ) as n_items_viewed,
max( if(event_name = 'purchase', 1, 0)) as purchaser
@zjuul
zjuul / default.yml
Created June 26, 2025 07:10
Espanso Big Query SQL Starter
matches:
- trigger: ":4"
replace: "GA4Dataform"
- trigger: ":micro"
replace: "timestamp_micros(event_timestamp) as ts"
- trigger: ":ts"
replace: "_table_suffix between '20210701' and '20210701'"
- trigger: ":sql"
replace: "select\n\tdate,\ncount(*) as n\n\bfrom x\ngroup by 1\norder by n desc"
- trigger: ":evs"