Editing a Quarto Dashboard, Project Memos, Etc.

Author

Penelope Pooler Eisenbies

Published

April 16, 2025

Housekeeping

  • HW 5 - Part 2 is due Wednesday 4/16

  • This is the last HW Assignment and requires very little coding (Code is provided).

  • You are asked to place and format pages and chunks correctly to expand and update your dashboard as instructed.

  • You are also instructed to complete this assignment on Posit Cloud so that you can gain familiarity with the online platform.

  • HW 5 - Part 2 was introduced last week, and I will provide additional helpful information today.

Plan for This Week and Next Week

  • Format and requirements for the project memos.

  • Project Presentation Information.

  • Other ways to use R/RStudio and Collaborate.

  • Tuesday 4/22 will be mostly an in-class work day.

Requested/Selected Topics

  • This week and 4/22 are planned as short lecture days

    • If I receive questions that are useful to all I will incorporate topics

    • Goal is to provide information to all students while still keeping time open for group work.

Background for HW 5 - Part 2

Syracuse University launched Six University-wide Shared Competencies

From the website:

“Undergraduate students develop competencies through their major degree courses, liberal arts requirements, and co-curricular experiences.”

Overall Goal of Shared Competencies:

  • Regardless of major, when students attain their undergraduate degree, they will be competent in these six essential area.

  • This course, BUA 455 - Data Management for Business, contributes to a student’s compentency in Information Literacy and Technology Agility (ILTA).

Information Literacy and Technology Agility

  • Technology Agility skills are taught in every assignment and task throughout the course.

  • Information literacy skills are primarily addressed in HW 5 - Part 2 and in the course project.

  • Essential Information Literacy Skills include

    • Attributing data sources and software

    • Comparing and evaluating different options for presenting information to determine the right choice for a specific situation.

HW 5 - Part 2

  • This assignment expands the dashboard created in HW 5 - Part 1.

  • For some tasks, you are adding plots that are redundant with previous ones

    • You will be asked to compare and contrast these data visualization options.

Review and New Skills for HW 5 and Project

Adding a Page to a dashboard

  • This is straightforward but it requires careful placement of the the provided text and code,

  • The goal is to examine the dashboard, the provided text and code to be added, and the changes resulting from these additions.

  • In-class Demo

Skills for HW 5 - Part 2 and Project

Adding linked text to Quarto files

  • This same format will work in Word, Powerpoint, Html, and Pdf output files

    • Text to link goes in square brackets followed by link is in round brackets
  • Examples:

  • In HW 5 - Part 2 you are required to add a data source link for Statista on Page 8.

  • You may also add links in other places where you are asked to edit and expand the textual content.

Skills for HW 5 - Part 2 and Project

Adding an image

  • The format will work in Word, Powerpoint, Html, and Pdf output files

  • Similar to adding linked text:

    • Exclamation point followed by square brackets which can include a caption (optional)

    • Directly Followed by image file name in parentheses

    • Note that {fig-align="center"} is optional and there other options as well.

    • More about Quarto Figure Options

  • Image file should be in img folder and img folder is in specified image file name.

In HW 5 - Part 2 you will create a new Page 1 with no title and add this image to the main part of the page.

HW 5.2 Image

HW 5.2 Image
  • NOTE: You can save and export an R data visualization, and place that figure elsewhere as .png or .jpg file.

Skills for HW 5 - Part 2 and Project

Adding an image within a code chunk

  • Another way to add an image is to use commands within an R Chunk

    • Note that full file name and location is in quotes.
  • This option may allow you to use some of the chunk options to modify sizing.

  • The image is centered using the fig.align option and resized using the fig.dim option.

Code
```{r fig.align='center', fig.dim=c(4,6)}
#|label: r chunk figure command

knitr::include_graphics("img/HW5_Pt2_Page1_Graphic.png")
```

Skills for HW 5 - Part 2 and Project

Citing sources

  • If you are publishing in a journal, or working for a company, defer to the citation format they prefer.

  • In this course, all citations should be formatted consistently

    • Choose one format and stick with it.
  • Here is link with suggestions on how to cite websites

  • Using .qmd templates for memos will make citing R, RStudio and R packages very straightforward and you can also use that format for data sources.

Citing R

  • Type citation() in the R Console to see full citation and then copy and paste formatted citation:

R Core Team (2025). R: A Language and Environment for Statistical Computing. R Foundation for Statistical Computing, Vienna, Austria. https://www.R-project.org/.

Skills for HW 5 - Part 2 and Project

Citing R packages

  • Type citation(‘package_name’) in the R console.

  • Replace package_name with name of package or package suite, e.g. citation('tidyverse').

  • Note that tidyverse is a suite of packages that includes: lubridate, forcats, stringr, dplyr, purrr, readr, tidyr, tibble, ggplot2, tidyverse

To cite tidyverse:

Wickham H, Averick M, Bryan J, Chang W, McGowan LD, François R, Grolemund G, Hayes A, Henry L, Hester J, Kuhn M, Pedersen TL, Miller E, Bache SM, Müller K, Ooms J, Robinson D, Seidel DP, Spinu V, Takahashi K, Vaughan D, Wilke C, Woo K, Yutani H (2019). “Welcome to the tidyverse.” Journal of Open Source Software, 4(43), 1686. doi:10.21105/joss.01686 https://doi.org/10.21105/joss.01686.

Skills for HW 5 - Part 2 and Project

Citing RStudio

  • type RStudio.Version() in the R console

  • To cite RStudio:

Posit team (2025). RStudio: Integrated Development Environment for R. Posit Software, PBC, Boston, MA. URL http://www.posit.co/.

Inline R code

Required for project, not HW 5 - Part 2

  • In your projects you are asked to include inline code in the text panels

  • This is a good skill to know when managing and curating data over time.

  • It allows you to include R objects, variables, and calculations in text

  • Inline R code will automatically update when data or R code are updated.

  • To use inline code:

    1. Calculate and format values in an R chunk that can be hidden using echo = F

    2. Write text in your dashboard or report using inline chunk format.

      • This ‘micro-chunk’ can include a saved value, a calculation, etc..

      • The ‘micro-chunk’ will not appear in your output document, and it will be replaced by the output value or calculation output you specify in the chunk.

R Inline Code Example

The small chunk that follows imports a dataset and does some of the data management tasks we have covered to a dataset about yearly movie gross.

In a dashboard or report, this chunk could be hidden with echo = F in the chunk header.

Code
```{r warning=F}
# import and manage data to keep top movies from each year
bom_yr <- read_csv("data/bom_yearly_top_gross_2025_04_14.csv", show_col_types = F, skip=12) |>
  filter(!is.na(Releases)) |>                              # remove rows with NAs
  slice(1:16) |>                                           # keep first 15 rows
  rename("yr"="Year", "tot_gross" = "Total Gross", "num1" = "#1 Release") |>
  select(yr, tot_gross, num1) |>
  mutate(yr = as.integer(yr),
         tot_gross = gsub("$", "", tot_gross, fixed = T),
         tot_gross = as.numeric(gsub(",", "", tot_gross, fixed = T))) 

# create variables for inline code
today <- Sys.Date()                                                # saves today's date
today_fmt <- stamp("Saturday, January 1, 1999", quiet = T)(today)  # formats date
#day_updated_fmt <-  stamp("Saturday, January 1, 1999", quiet = T)(today-??)

yr_to_date_gross <- round(bom_yr$tot_gross[1]/1000000000,2)        # formats & saves 1st gross
pct_of_prev <- round(bom_yr$tot_gross[1]/bom_yr$tot_gross[2]*100)  # creates formatted ratio 

tenyr_pp_avg <- (mean(bom_yr$tot_gross[7:16])/1000000000) |> round(2)
pct_of_tenyr_pp_avg <- ((yr_to_date_gross/tenyr_pp_avg)*100) |> round()

# data link for exercise:
# https://www.boxofficemojo.com/year/?ref_=bo_nb_hm_secondarytab
```

R Inline Code Example

  • In a polished document, the previous chunk could be hidden.

  • The document itself could have the following text which could be updated daily:

Presented Text with In-line Code

As of Wednesday, April 16, 2025, the top grossing film of this year is A Minecraft Movie.

So far this year, the domestic total movie gross is 1.85 billion dollars.
This total is 22% of last year’s total domestic movie gross.

In-class Exercise

  1. In the previous chunk:

    • Create an additional formatted date value, day_updated_fmt to indicate when data were updated. Data were updated on 4/14/2025 (yesterday).

    • Calculate average of total gross for the ten years before the pandemic (2010 - 2019). Save this value as an object, tenyr_pp_avg (code provided).

    • Calculate the ratio of the current gross for 2024 divided by the ten year average. Save this ratio as pct_of_tenyr_pp_age (code provided).

  2. Complete the full text section shown below in the section titled Updated Text for In-class Exercise

    • Add two micro-chunks using the values you created with the code provided.

    • Add the link for the linked text.

      • Optional: add {target="_blank"} after paretheses so link will always open in a new tab.

In-class Exercise Cont’d

  1. Render your class notes (.qmd) so that you have the final output as an HTML file.

  2. Save TWO screenshots of the text below:

    • A screenshot of the text from this .qmd file HTML file from the header line that begins Updated Text… to the sentence that ends …link().

      • Save as In-class_Exercise_Week13_QMD_FirstName_LastName.png.
    • A screenshot of the text from the rendered HTML file from the header line that begins Updated Text… to the sentence that ends …link().

      • Save as In-class_Exercise_Week13_HTML_FirstName_LastName.png.

Updated Text for In-class Exercise

As of Wednesday, April 16, 2025, the top grossing film of this year is A Minecraft Movie.

So far this year, the domestic total movie gross is 1.85 billion dollars.

This total is 22% of last year’s total domestic movie gross.

This total is also _____% of the pre-pandemic ten-year average of domestic annual gross.

These data were last updated on _____ and can be accessed at this link.

Final Projects

Presentations are on Thursday 4/24

  • If your group needs to present first or last due to a conflict, let me know ASAP.

    • Otherwise, random order will be posted by Wednesday (4/23).
  • Attendance required by all

  • Dress: Business casual with emphasis on casual

  • Suits, Ties, Dresses, and Jackets are NOT required, No sweats t-shirts or pjs.

  • You will present better if you dress the part (at least a little).

  • All students should be prepared to answer questions about the work presented.

  • Each student will evaluate other groups and their own group members

  • All project components must be submitted by Friday, May 2nd at 6:00 PM

Project Memos

  • Project Description - Memos are described on Page 6

  • There is also a zipped R project that can be downloaded here.

    • I have uploaded this project to each group’s workspace.
  • Supervisor Memo’s Goal:

    • Provide your supervisor with what they need

    • They will want to be knowledgeable about the data and dashboard, but have very limited time.

    • Predict questions they (supervisor) might have and questions a client might ask.

  • Colleague Memo’s Goal:

    • Colleague should be able to follow memo to update dashboard quickly and seamlessly when new data are available.

    • I (or TA) will follow memo and verify that instructions are clear, links are functional, and I can update dashboard based on this memo. when new data are available.

Talking about Your Skillset

  • Explaining your skillset is hard, but it’s getting easier.

  • As Data Science and Analytics grow in importance, more people understand what this skill set can offer.

  • However, you should not assume that interviewers, colleagues, supervisors understand your skills.

  • This White Paper from Data camp (also posted on Blackboard) is helpful.

    • Starting on Page 9 it lays out different roles people take on when working with data.

    • Comparing these descriptions to skills you learn in this major should give you a lot of confidence.

    • Provides validation that you can take on more advanced roles.

R Quarto and older Markdown formats

  • Documents can be rendered from Quarto (.qmd) files or older R Markdown (.Rmd) files.

    • HTML, Word documents, PDf

    • In the Fall of 2024, I transitioned this course to Quarto but R Markdown is very similar.

    • Predecessor to Quarto Dashboard was flexdashboard package in R

    • Quarto Presentations (RevealJS) are used in this course.

      • Straightforward to convert slides to HTML notes files

      • Powerpoint is an alternative but doesn’t work as well with Quarto

Going Further with Quarto

  • Quart and Markdown files should be your default in data management and analysis work.

  • Examine Examples provided in BUA 455

  • Examine Examples in Quarto Gallery

    • click on code symbol </> to see the code used to create the documents or presentations

    • Examine and modify code for your document

    • Also use Google, website documentation, and stack overflow for questions

  • Quarto’s Guide and Reference pages are excellent.

  • AI is also very helpful (Just ask)

Resources - Where to go next

Tutorials

  • As SU Students you also have free access to Linkedin Learning

    • Great tutorials in R, Python, SQL

    • R is versatile and powerful, but employers may prefer Python, SQL, or another language/environment because that is what they know.

    • NOTE: Python, SQL, others can all be utilized with RStudio and Quarto.

    • Different languages can be combined in one R Markdown or Quarto document in separate chunks.

  • DataCamp - Not Free, but Excellent.

  • Other companies are quickly developing tutorial training too (some are good).

Sharing and Collaborating

GitHub vs. RPubs

  • Last week I introduced you to Rpubs which is ideal from sharing a dashboard.

    • I publish my slides on RPubs because they are not collaborative

    • I publish my course websites using Quarto Pub which looks a little more professional.

  • Alternatively, you may have already come across GitHub in searching for files or a package.

    • Prior to Quarto, GitHub was required for files where data, code and text are maintained together as a project, referred to as a repository or repo.

    • Not required for finished dashboard.

  • GitHub is an online code sharing and code development platform.

  • Many R packages start as development code on GitHub and over time they are refined and published.

More about GitHub

  • Once you create free account, you can learn more about how it works in this tutorial.

  • Collaborative coding is common on GitHub but is a little more complex than working on a shared drive.

    • Developers of games, R packages, other software, etc., have huge code files and need to protect them.

    • There is a system in place (version control) where people can create a project with multiple code versions and edits.

      • Over time a project develops more and more branches, like a tree, but the trunk.
    • Original code is preserved and changes can be incorporated as they are verified and approved.

More Ways to Collaborate

  • Similar to Kaggle in that you can create an account and save projects there.
  • Used by Kivanc Avrenli with excellent results

Tips for a Better Dashboard

A good rule for this project (every project): Edit yourself

  • You may have a lot to say and show, BUT always consider:

    • What can you present WELL in the space an time you have?
  • An important skill to develop is the ability to filter the data to a representative subset, especially for a visualization.

  • Think about what data can be presented well and what the audience can digest.

  • Don’t try to show too much in any one plot or panel.

  • You can always show other parts of the data by:

    • creating more pages and tabs.

    • creating multi-plot grids to show other part of the data.

More Tips for a Better Dashboard

At each stage of the process, take a step back and examine each dashboard page as if you are seeing it with fresh eyes.

  • As you do that, ask yourself these questions:

    • Does this page achieve a specific goal?

    • Is the point of this page clear?

      • If not, how can I edit this page to clarify the message?
    • Are the text and symbols readable from any distance?

    • What can I simplify to make it more clear?

    • Are there aspects I think are important that might not be obvious?

      • If so, how can I modify the page or dashboard to highlight the key aspects?
  • When in doubt, ask someone to look it and ask if they understand what you hope to convey.

Tables in Dashboards and Documents

  • This course focuses mostly on data visualizations, with a few table summaries.

  • Creating a more complex table, may be useful to you and could be included as an additional main panel in your dashboard instead of side panel.

  • An alternative to kable are the table formatting options in the gt package

    • gt is included in the setup chunk for htis lecture.
  • The gt website has many examples with detailed step by step instructions.

  • Notes about examples on gt website:

    • Examples use the older pipe notation %>% which is identical in function to |>.

    • Examples also use different commands to complete the same data management tasks covered in BUA 455.

    • If you are unsure about a command you come across ask me, or google it. The R help index is also good.

      • e.g. ?glue or ?glue::glue is the glue command in glue package.

Tables in Dashboards and Documents

Let’s look at what can be customized in a gt table:

Example:

Importing, Summarizing and Displaying Stock Data

Code
```{r stock import and summary}
getSymbols("^GSPC", from="2024-7-01", to="2025-04-01") 

snp9 <- GSPC |>
  fortify.zoo() |> as_tibble(.name_repair = "minimal") |>
  rename("date" = "Index") |>
  mutate(mnth=month(date))|>
  group_by(mnth) |>
  filter(date==max(date)) |>  # filtered data to last day of each month
  ungroup() |>
  select(-c(6,8))    # remove volume and month variables
names(snp9)[2:6] <- c("Open", "High", "Low", "Close", "Adjusted")
head(snp9,3)
```
[1] "GSPC"
# A tibble: 3 × 6
  date        Open  High   Low Close Adjusted
  <date>     <dbl> <dbl> <dbl> <dbl>    <dbl>
1 2024-07-31 5506. 5552. 5494. 5522.    5522.
2 2024-08-30 5613. 5651. 5582. 5648.    5648.
3 2024-09-30 5727. 5765. 5704. 5762.    5762.

Example:

Importing, Summarizing and Displaying Stock Data

  • The code below does not make a new tibble or data frame

  • Instead it creates a formatted table object that can be output as a .png file like a plot.

    • kable also creates a formatted table object, but gt has more features.
  • As with plots, I am saving this object and then displaying it on the next slide.

Code
```{r create formatted gt table}
snp_fmt <- snp9 |>
  gt(rowname_col = "date") |>
  tab_header(title = "S&P 500",
             subtitle = "Last Trading Day of Previous Nine Months") |>
  tab_stubhead(label = "Date") |>
  fmt_date(columns=date, date_style=3) |>  # formats date
  fmt_currency(columns=Open:Adjusted, currency = "USD")|>     # formats values as US$
  tab_footnote("Data Source: https://finance.yahoo.com") |>
  tab_footnote("Symbol: ^GSPC")
```

Presenting a GT Table

In a dashboard or document, the code would obviously be hidden, but it is shown here:

Code
```{r display formatted table}
snp_fmt         # code to display created table
```
S&P 500
Last Trading Day of Previous Nine Months
Date Open High Low Close Adjusted
Wed, Jul 31, 2024 $5,505.59 $5,551.51 $5,493.75 $5,522.30 $5,522.30
Fri, Aug 30, 2024 $5,612.74 $5,651.37 $5,581.79 $5,648.40 $5,648.40
Mon, Sep 30, 2024 $5,726.52 $5,765.14 $5,703.53 $5,762.48 $5,762.48
Thu, Oct 31, 2024 $5,775.34 $5,775.34 $5,702.86 $5,705.45 $5,705.45
Fri, Nov 29, 2024 $6,003.98 $6,044.17 $6,003.98 $6,032.38 $6,032.38
Tue, Dec 31, 2024 $5,919.74 $5,929.74 $5,868.86 $5,881.63 $5,881.63
Fri, Jan 31, 2025 $6,096.79 $6,120.91 $6,030.93 $6,040.53 $6,040.53
Fri, Feb 28, 2025 $5,856.74 $5,959.40 $5,837.66 $5,954.50 $5,954.50
Mon, Mar 31, 2025 $5,527.91 $5,627.56 $5,488.73 $5,611.85 $5,611.85
Data Source: https://finance.yahoo.com
Symbol: ^GSPC

Editing a GT Table for a Presentation

  • A table in a dashboard side panel should be small.

  • Previous table would not fit, but we can select variables and shorten the date.

  • Limit the table to key variables that highlight important characteristics of your data.

  • Other variables, e.g. Open, Low, can be shown in plot

Code
```{r edited smaller table}
snp_sm <- snp9 |>
select(1,3,6) |>
  gt(rowname_col = "date") |>
  tab_header(title = "S&P 500",
             subtitle = "Last Trading Day of Previous Nine Months") |>
  tab_stubhead(label = "Date") |>
  fmt_date(columns=date, date_style=6) |>                   
  fmt_currency(columns=High:Adjusted, 
               currency = "USD")|>     
  tab_footnote("Source: https://finance.yahoo.com") |>
  tab_footnote("Symbol: ^GSPC")
```
S&P 500
Last Trading Day of Previous Nine Months
Date High Adjusted
Jul 31, 2024 $5,551.51 $5,522.30
Aug 30, 2024 $5,651.37 $5,648.40
Sep 30, 2024 $5,765.14 $5,762.48
Oct 31, 2024 $5,775.34 $5,705.45
Nov 29, 2024 $6,044.17 $6,032.38
Dec 31, 2024 $5,929.74 $5,881.63
Jan 31, 2025 $6,120.91 $6,040.53
Feb 28, 2025 $5,959.40 $5,954.50
Mar 31, 2025 $5,627.56 $5,611.85
Source: https://finance.yahoo.com
Symbol: ^GSPC

Project Questions

Evaluations

  • Course Evaluations are very important.

  • I assume the portal will be open on 4/17.

  • Please take the time to fill out evaluations for all classes when they are available.

Key Points from This Week

  • More Details about HW 5 - Part 2 (Due 4/16)

  • Project Details

    • Citations, linked text and inline R code, Memos

    • Dashboard tips and alternative table format (gt package)

  • Resources for going further in R, RStudio, Quarto, Python

  • Resources for Collaboration

    • Posit Cloud, Github, RPubs, Kaggle, Google Colab
  • White Paper to help you explain your

You may submit an ‘Engagement Question’ about each lecture until midnight on the day of the lecture. A minimum of four submissions are required during the semester.