Skip to main content
100%

Connexion à PostgreSQL + histogramme avec ggplot2

✓ Published0🌍 Public
RRCura
Last edited Jun 12, 2018
Created on Jun 12, 2018

This example demonstrates how to create a histogram directly from a PostgreSQL database table using R. The code first establishes a database connection with the `DBI` and `RPostgreSQL` packages, then uses `dplyr` and `dbplyr` to query the table as a remote data frame. The `ggplot2` library renders the histogram via `geom_histogram`, mapping a specified column to the aesthetic. Finally, the connection is explicitly closed with `dbDisconnect`. The code illustrates a workflow for plotting distributed data without loading it entirely into local memory.

AI-generated description

Similar vizzes