Gist c11433a697bc7660ed4cde37278fb580
✓ Published0🌍 Public
RRCura
Last edited Oct 12, 2022
Created on Oct 12, 2022
This example demonstrates how to query a DuckDB database from R using the `dbplyr` and `duckdb` packages, showing the results of a simple aggregation of railway station data grouped by country. The code first creates an in-memory DuckDB connection, defines a view over a CSV file containing station information, and registers it as a tibble. It then performs a grouped count operation using dplyr verbs, which is lazily translated to SQL, and finally materializes the result locally with `collect()`. The output displays the number of stations per country, revealing a clear geographic distribution across European nations.
AI-generated description