How to Plot Data from Databases in R Efficiently: dbplot

Share this & earn $10
StatistikinDD
Published at : 17 Sep 2021
668 views
24
0

Dealing with large datasets that live in a database, plotting in R can be challenging. How to do it efficiently?

Using data about world-wide chart success of songs and albums, we create an in-memory database to get going quickly without having to worry much about infrastructure. Efficiency in plotting from databases is largely determined by how much data you need to pull into R’s memory. Many plots only require aggregated data, so doing calculations inside the database pays off in terms of data transfer requirements.

We look at bar plots to compare different approaches: An inefficient way where ggplot2 does the aggregation, then manual calculation inside the database, as well as using a dedicated function from the dbplot package by Edgar Ruiz.

Further examples include a histogram, a scatterplot and a powerful alternative, a raster plot.

This is my first video that is based on a xaringan presentation, which builds on R markdown, knitr, and the remark.js javascript library. Let me know in the comments what you think of this format. I like it because all my R code stays in one place: a markdown document from which the presentation is rendered. So no copying and pasting of R code and tables and plots.

Code: https://github.com/fjodor/dataviz_ideas
File: Plotting-from-database.Rmd

More information on working with databases in R: https://db.rstudio.com/
Ideas for this video based on "Best Practices - Creating Visualizations"



Blog (German, translate option): https://statistik-dresden.de/statistik-blog
R Workshops: https://statistik-dresden.de/r-schulungen
Twitter: https://twitter.com/StatistikInDD
Facebook: https://www.facebook.com/statistikdresden/

Playlist: Music chart history
https://www.youtube.com/playlist?list=PL4ZUlAlk7QidRlzHEiHX09htXMAbxTpjW

ggplot2RStudiodbplot

Nioh 2 - Soundtrack - The Interim

Nioh 2 - Soundtrack - The Interim

More Often Than Not - Eric Andersen

More Often Than Not - Eric Andersen

Celtic Woman - It Came Upon A Midnight Clear (Live At The Helix In Dublin, Ireland/2013)

Celtic Woman - It Came Upon A Midnight Clear (Live At The Helix In Dublin, Ireland/2013)

The Toothless Monster Book and Plush Set from Three Little Hens

The Toothless Monster Book and Plush Set from Three Little Hens

African Bullfrog swallows a large Snake【WARNING LIVE FEEDING】

African Bullfrog swallows a large Snake【WARNING LIVE FEEDING】

The Blood Gangs Formative Years 1969-1974

The Blood Gangs Formative Years 1969-1974

Are Ye Able (with lyrics)

Are Ye Able (with lyrics)

How to calculate discount with percentage

How to calculate discount with percentage

NECESSARY ENDINGS · Henry Cloud

NECESSARY ENDINGS · Henry Cloud

Becky Hill & David Guetta - Remember (Lyrics)

Becky Hill & David Guetta - Remember (Lyrics)

LSD TRIP (Crazy Video)

LSD TRIP (Crazy Video)

Acknowledge and be Protected | Today's Blessing | Dr. Shilpa Samuel Dhinakaran

Acknowledge and be Protected | Today's Blessing | Dr. Shilpa Samuel Dhinakaran

What is a 401(k)?

What is a 401(k)?

Singles 2 - Επεισόδιο 14 HD

Singles 2 - Επεισόδιο 14 HD

The History of Vin Diesel's Surprisingly Excellent Riddick Games

The History of Vin Diesel's Surprisingly Excellent Riddick Games

these entitled parents are literally the worst

these entitled parents are literally the worst

My Portion by Jekalyn Carr  (Music)

My Portion by Jekalyn Carr (Music)

RINI - My Favourite Clothes [Official Music Video]

RINI - My Favourite Clothes [Official Music Video]

Arregou: Depois de gerar o caos, Bolsonaro recua e vê sua base rachar

Arregou: Depois de gerar o caos, Bolsonaro recua e vê sua base rachar

New Haircuts From Long to short | Best Bob Haircut Transformation For Women 2021

New Haircuts From Long to short | Best Bob Haircut Transformation For Women 2021

Did Sakurai intend to make Rest this good?

Did Sakurai intend to make Rest this good?

Mekh ZakhQ - PayOff x Maraljingoo, Munk Tugrik (Official Music Video)

Mekh ZakhQ - PayOff x Maraljingoo, Munk Tugrik (Official Music Video)

Doja Cat - Options (Visualizer) ft. JID

Doja Cat - Options (Visualizer) ft. JID

Air Conditioner - 10 hours of relaxing ambient sounds asmr

Air Conditioner - 10 hours of relaxing ambient sounds asmr

Man On The Moon ft Amra - Never (Official Video)

Man On The Moon ft Amra - Never (Official Video)

What's Education For?

What's Education For?

ரூ10 முதல்.. Gifts Cheapest Price/Surprise Gifts,Valentine Gifts,Customized Gifts/Delivery Available

ரூ10 முதல்.. Gifts Cheapest Price/Surprise Gifts,Valentine Gifts,Customized Gifts/Delivery Available

The Fool | দ্যা ফুল | Musfiq R. Farhan | Ahona | Bannah | Bangla New Eid Natok 2019

The Fool | দ্যা ফুল | Musfiq R. Farhan | Ahona | Bannah | Bangla New Eid Natok 2019

Gregory and the Hawk - In Fact - Lyrics

Gregory and the Hawk - In Fact - Lyrics

Why so many Covid-19 variants are showing up now

Why so many Covid-19 variants are showing up now

Shouse - Love Tonight (Radio Edit)

Shouse - Love Tonight (Radio Edit)

CAN'T BE A TANK IF YOU'RE DEAD // XCOM 2 WOTC 2021 MODDED // Part 80 // COVERT INFILTRATION

CAN'T BE A TANK IF YOU'RE DEAD // XCOM 2 WOTC 2021 MODDED // Part 80 // COVERT INFILTRATION

Inferring | Reading Strategies | EasyTeaching

Inferring | Reading Strategies | EasyTeaching

Joseph O’Brien - The Average (Lyrics / Lyric Video)

Joseph O’Brien - The Average (Lyrics / Lyric Video)

Watch live: Track the impact of global warming on the world

Watch live: Track the impact of global warming on the world

Learn English Vocabulary | Varied

Learn English Vocabulary | Varied

Spoke of Shadows : Face in the window

Spoke of Shadows : Face in the window

Light Weight (Official Video) | Kulwinder Billa | MixSingh | Latest Punjabi Song 2018

Light Weight (Official Video) | Kulwinder Billa | MixSingh | Latest Punjabi Song 2018

LOOKING for some RUN GOOD! - 2021 DNegs WSOP Poker VLOG Day 10

LOOKING for some RUN GOOD! - 2021 DNegs WSOP Poker VLOG Day 10

AGA 江海迦 -《Wonderful U》 MV

AGA 江海迦 -《Wonderful U》 MV

I Got A Tattoo of My Ex - Doing the OPPOSITE of What Matt Says For 24 Hours

I Got A Tattoo of My Ex - Doing the OPPOSITE of What Matt Says For 24 Hours

As I Lay Dying - Through Struggle (OFFICIAL VIDEO)

As I Lay Dying - Through Struggle (OFFICIAL VIDEO)

ENOUGH ËVIDËNCË HAS BEEN PROVIDED TO FLIP THE ËLËCTÏ0N BACK TO TRÜMP

ENOUGH ËVIDËNCË HAS BEEN PROVIDED TO FLIP THE ËLËCTÏ0N BACK TO TRÜMP

Remember The OG Days! 😢 #shorts

Remember The OG Days! 😢 #shorts

TOUR MY NEW KITCHEN! TURNING MY HUSBAND'S GARAGE INTO MY DREAM KITCHEN!

TOUR MY NEW KITCHEN! TURNING MY HUSBAND'S GARAGE INTO MY DREAM KITCHEN!

♫♪  Peter Cetera and Cher ~  After All  ♪♫

♫♪ Peter Cetera and Cher ~ After All ♪♫

Mad Minox, Kandai Mukati Vanhu Vanorova Mutoriro Without Charge Ndiyo Detox @ Toronto, Canada 2021

Mad Minox, Kandai Mukati Vanhu Vanorova Mutoriro Without Charge Ndiyo Detox @ Toronto, Canada 2021

Niki wants to find planets and builds toy robots

Niki wants to find planets and builds toy robots

mc gkioyzman-Stop-400 official music video

mc gkioyzman-Stop-400 official music video