Rating Pinot Wines: Is More Expensive Better?

R
Data Tables
Revolutionizing Data Tables: Visual Appeal & Comprehension. Explore techniques for aesthetically pleasing & informative tables. Enhance data presentation with design principles & innovative software.
Author

Brian Cervantes Alvarez

Published

February 20, 2023

Modified

April 8, 2025

Yapper Labs | AI Summary Model: ChatGPT o3-mini-high

I transformed and aggregated data from a Pinot wines dataset to compute key metrics such as average and standard deviation of wine points and prices by province, and enhanced the presentation using advanced design principles. I developed interactive, aesthetically pleasing tables with DT and gt, incorporating sparklines and custom themes to clearly visualize trends and facilitate data comprehension. This project underscores my proficiency in data wrangling, innovative visualization, and the application of design techniques to improve the clarity and impact of data communication.

Abstract

This project aims to explore alternative techniques for designing visually appealing and comprehensible data tables. Traditional Excel spreadsheets often lack readability and visual impact. By incorporating design principles such as color theory, typography, and layout, we aim to create visually striking data tables that effectively convey information. Additionally, we will evaluate innovative software tools and platforms that offer user-friendly options for creating functional and aesthetically pleasing data tables. Enhancing data presentation is crucial for improving interpretation and understanding.

Introduction

Excel spreadsheets are widely used for organizing and presenting data. However, their conventional format can be tedious and challenging to read, hindering data comprehension. This project seeks to address this limitation by exploring various techniques to design visually appealing and comprehensible data tables.

The primary focus is to create data tables that are not only aesthetically pleasing but also convey information effectively. By employing design principles such as color theory, typography, and layout, we aim to enhance the visual impact and readability of data tables. This will involve experimenting with different combinations of colors, fonts, and arrangement patterns to find the most optimal design choices.

It is crucial to recognize that the presentation of data plays a significant role in its interpretation and understanding. The traditional Excel format often lacks visual cues to highlight key data points or insights. Therefore, this project seeks to explore new and innovative methods of presenting data tables that not only serve their functional purpose but also captivate the audience with their visual appeal.

Advanced Data Tables

Code
library(tidyverse)
library(magrittr)
library(DT)
library(gt)
library(gtExtras)
library(countrycode)
library(downloadthis)
library(svglite)


ds <- read_rds("../../../assets/datasets/pinot.rds")

# head(ds)
Code
ds_starter <- ds %>%
    mutate(
        province = as.factor(province),
        price = price,
        thetaPointMean = mean(points),
        thetaPriceMean = mean(price)
    )

ds_starter %>%
    arrange(province, year) %>%
    select(
        Province = province,
        Year = year,
        Price = price,
        Points = points,
        Description = description
    ) %>%
    datatable(.,
        filter = "bottom",
        extensions = "Buttons",
        options = list(
            dom = "Bfrtip",
            buttons = c("copy", "csv", "excel"),
            initComplete = JS(
                "function(settings, json) {",
                "$(this.api().table().header()).css({'background-color': '#131F4F', 'color': '#fff'});",
                "}"
            )
        )
    )
Code
ds_summary <- ds_starter %>%
    group_by(province) %>%
    arrange(year) %>%
    summarise(
        pointsMean = mean(points, na.rm = TRUE),
        pointsSD = sd(points),
        priceMean = mean(price, na.rm = TRUE),
        priceSD = sd(price),
        points = list(points),
        price = list(price),
        .groups = "drop"
    )
Code
excel_file_attachment <- ds_summary %>%
    download_this(
        output_name = "Pinot_Noir_Summary",
        output_extension = ".xlsx", # Excel file type
        button_label = "Download Excel",
        button_type = "primary", # change button type
    )

Adding Trend Lines To Summary Tables

GT Table Code
fancyTbl <- ds_summary %>%
    gt() %>%
    # format the numeric output to 3 digit rounding
    fmt_number(
        columns = c(pointsMean, pointsSD, priceMean, priceSD),
        decimals = 3
    ) %>%
    # create nice labels for a few ugly variable names
    cols_label(
        province = "Province",
        pointsMean = "Avg. Points",
        pointsSD = "Std. Dev. Points",
        priceMean = "Avg. Price",
        priceSD = "Std. Dev. Price",
        points = "Points Trend",
        price = "Price Trend",
    ) %>%
    # Plot the sparklines from the list column
    gt_plt_sparkline(points,
        type = "ref_median",
        same_limit = TRUE
    ) %>%
    gt_plt_sparkline(price,
        type = "ref_median",
        same_limit = TRUE
    ) %>%
    # use the guardian's table theme
    gt_theme_guardian() %>%
    # give hulk coloring to the Mean Human Rights Score
    gt_hulk_col_numeric(pointsMean) %>%
    gt_hulk_col_numeric(priceMean) %>%
    # create a header and subheader
    tab_header(title = "Province Pinot Wine Summary", subtitle = "Source: Dr. Hendrick") %>%
    # attach excel file
    tab_source_note(excel_file_attachment)
# save the original as an image
# gtsave(fancyTbl, "table.png")
# show the table themed in accordance with the page
fancyTbl
Province Pinot Wine Summary
Source: Dr. Hendrick
Province Avg. Points Std. Dev. Points Avg. Price Std. Dev. Price Points Trend Price Trend
Burgundy 90.438 2.989 98.035 132.856 89.0 83.0
California 90.517 2.831 47.465 18.553 91.0 34.0
Casablanca_Valley 86.282 2.428 21.107 11.953 87.0 30.0
Marlborough 87.550 2.245 27.668 13.833 85.0 25.0
New_York 87.748 2.268 25.679 9.565 88.0 35.0
Oregon 89.489 2.663 44.856 20.209 90.0 22.0

Conclusion

This project highlights the importance of visually appealing and comprehensible data tables as an alternative to Excel. By incorporating design principles and exploring innovative tools, we enhance data presentation and interpretation. It calls for adopting alternative techniques to design data tables. By embracing visually appealing formats, we improve data comprehension, communication, and unlock new possibilities for visualization and analysis.

Data References

Arel-Bundock, Vincent. 2024. Countrycode: Convert Country Names and Country Codes. https://vincentarelbundock.github.io/countrycode/.
Arel-Bundock, Vincent, Nils Enevoldsen, and CJ Yetman. 2018. “Countrycode: An r Package to Convert Country Names and Country Codes.” Journal of Open Source Software 3 (28): 848. https://doi.org/10.21105/joss.00848.
Bache, Stefan Milton, and Hadley Wickham. 2022. Magrittr: A Forward-Pipe Operator for r. https://magrittr.tidyverse.org.
Grolemund, Garrett, and Hadley Wickham. 2011. “Dates and Times Made Easy with lubridate.” Journal of Statistical Software 40 (3): 1–25. https://www.jstatsoft.org/v40/i03/.
Iannone, Richard, Joe Cheng, Barret Schloerke, Ellis Hughes, Alexandra Lauer, JooYoung Seo, Ken Brevoort, and Olivier Roy. 2024. Gt: Easily Create Presentation-Ready Display Tables. https://gt.rstudio.com.
Mattioni Maturana, Felipe. 2023. Downloadthis: Implement Download Buttons in Rmarkdown. https://github.com/fmmattioni/downloadthis.
Mock, Thomas. 2023. gtExtras: Extending Gt for Beautiful HTML Tables. https://github.com/jthomasmock/gtExtras.
Müller, Kirill, and Hadley Wickham. 2023. Tibble: Simple Data Frames. https://tibble.tidyverse.org/.
Spinu, Vitalie, Garrett Grolemund, and Hadley Wickham. 2024. Lubridate: Make Dealing with Dates a Little Easier. https://lubridate.tidyverse.org.
Wickham, Hadley. 2016. Ggplot2: Elegant Graphics for Data Analysis. Springer-Verlag New York. https://ggplot2.tidyverse.org.
———. 2023a. Forcats: Tools for Working with Categorical Variables (Factors). https://forcats.tidyverse.org/.
———. 2023b. Stringr: Simple, Consistent Wrappers for Common String Operations. https://stringr.tidyverse.org.
———. 2023c. Tidyverse: Easily Install and Load the Tidyverse. https://tidyverse.tidyverse.org.
Wickham, Hadley, Mara Averick, Jennifer Bryan, Winston Chang, Lucy D’Agostino McGowan, Romain François, Garrett Grolemund, et al. 2019. “Welcome to the tidyverse.” Journal of Open Source Software 4 (43): 1686. https://doi.org/10.21105/joss.01686.
Wickham, Hadley, Winston Chang, Lionel Henry, Thomas Lin Pedersen, Kohske Takahashi, Claus Wilke, Kara Woo, Hiroaki Yutani, Dewey Dunnington, and Teun van den Brand. 2024. Ggplot2: Create Elegant Data Visualisations Using the Grammar of Graphics. https://ggplot2.tidyverse.org.
Wickham, Hadley, Romain François, Lionel Henry, Kirill Müller, and Davis Vaughan. 2023. Dplyr: A Grammar of Data Manipulation. https://dplyr.tidyverse.org.
Wickham, Hadley, and Lionel Henry. 2025. Purrr: Functional Programming Tools. https://purrr.tidyverse.org/.
Wickham, Hadley, Lionel Henry, Thomas Lin Pedersen, T Jake Luciani, Matthieu Decorde, and Vaudor Lise. 2023. Svglite: An SVG Graphics Device. https://svglite.r-lib.org.
Wickham, Hadley, Jim Hester, and Jennifer Bryan. 2024. Readr: Read Rectangular Text Data. https://readr.tidyverse.org.
Wickham, Hadley, Davis Vaughan, and Maximilian Girlich. 2024. Tidyr: Tidy Messy Data. https://tidyr.tidyverse.org.
Xie, Yihui, Joe Cheng, and Xianying Tan. 2024. DT: A Wrapper of the JavaScript Library DataTables. https://github.com/rstudio/DT.