top of page

[Tutorial Kit] New Tools for Public Health Data: R Studio

  • Writer: Shamini V De Silva
    Shamini V De Silva
  • Mar 25
  • 5 min read

Updated: 5 days ago


Workshop Chapters

Recorded live Jan 27 2026, timestamps below

PART 1:

0:00 - Welcome

0:59 - About Us

3:10 - Addressing Imposter Syndrome

4:38 - Data Challenge Overview

5:00 - Q: What is a Key Stakeholder?

7:00 - TOPIC: Prenatal Care

PART 2:

9:09 - STEP-BY-STEP

16:45 - GETTING DATA


🎯 Data Challenge


Create a bar chart on prenatal care for your state.


The Plan

Collect key indicators for your community using free sources of prenatal care data in the United states, develop career-critical, foundational skills in R programming, and create a portfolio project.


Example bar chart created in Posit Cloud
Example bar chart created in Posit Cloud

3 Learning Objectives


  1. Query & Collect 📊 data on prenatal care in your region.

  2. Analyze data using the data tool: 🧰 🛠️ RStudio (Online).

  3. Visualize & Humanize data by creating a real-world portfolio project for a key stakeholder i.e. target audience.


Prerequisites. Beginner-friendly, some knowledge required:

  • RStudio functions

  • assigning a variable


Keywords and core concepts also covered:

  • Human-centered, design-first data

  • Basics of 🧰 🛠️ R programming in Posit Cloud

  • Upstream/Downstream health indicators



Here's what you'll need to successfully complete this challenge

  • ⏰ Time: 30-45 minutes

  • 🧰 Tools:

    • An account in Posit Cloud (a tool for running a cloud version of RStudio - no R software installation is needed)

  • 📊 Data:

    • Excel (.xlsx) file with data on Prenatal Care in the first trimester (%) (2020-2022) downloaded from the HRSA Maternal and Infant Health Mapping Tool (Timestamp 16:45 in the video above).

      • Health Indicator: Prenatal Care in the first trimester (%) (2020-2022). Estimated percentage of live births with first trimester prenatal care entry.

      • Data Source: Maternal and Infant Health Mapping Tool, Health Resources and Services Administration (2020-2022). https://data.hrsa.gov/topics/maternal-child-health/mchb-mapping


  • R code.

    • Download the R Code used for this project below.


Step-by-Step Walkthrough


The steps below will guide you to create a bar graph in Posit Cloud comparing national, state, and county-level prenatal care statistics.


Step 1: Set up Posit Cloud and create a new RStudio Project


Instead of installing R and RStudio locally, this tutorial uses Posit Cloud, a browser-based environment that runs RStudio online. We are using the Posit Cloud service to ensure that everyone is working in the same R environment.


The template code has been designed and tested specifically in the Posit Cloud environment (using R version 4.5.2 and tidyverse version 2.0.0, which is the latest at the time of this writing). If you choose to run the code in a local RStudio setup, some parts may not work as expected and may require modification.


To get started:

  1. Go to posit.cloud.

  2. Click Sign Up.

  3. Choose the free version for this project → Click 'Sign Up'

  4. Create an account using email or services like Google or GitHub.

  5. Once your workspace loads, click 'New Project' on the right-hand side of the screen.

  6. Select 'New RStudio Project' to start a new project. This will also open the RStudio interface within your browser.


Step 2: Upload the required files


The RStudio interface typically contains several panes:

  1. Script editor (top left pane) – where you write and edit code

  2. Console (bottom left pane) – where commands are executed

  3. Environment (top right pane) – displays objects and datasets loaded in the session

  4. Files/Plots/Packages (bottom right pane) – used to manage files, view plots, and access documentation



Because Posit Cloud runs online, any files you want to use must be uploaded manually.


  1. Download the R script file (.R) and the Excel file containing prenatal care data to your computer following the instructions above.

  2. Navigate to the Files section in the bottom right pane.

  3. Click the ‘Upload’ button → Click on ‘Browse’ → Select and upload each file you downloaded (R file and Excel file). Leave the target directory at the default location “/cloud/project/”.

  4. After uploading, you should see the files listed in the Files pane.


Please watch the video above for a demonstration of these steps (timestamp: 9:09 - STEP-BY-STEP).


Step 3: Open the R Script, install, and load the required packages


In the Files pane, click the .R script file (early_prenatal_care.R) to open it.

The script code will be displayed in the top left pane. This script contains the code used to generate the prenatal care bar graph.


The script also includes a header at the beginning that explains:

  • the purpose of the code,

  • how to use the code, and

  • copyright and attribution information (please provide appropriate credit if you plan to adapt and share the code).


Highlight and run the line of code that installs the tidyverse package - a collection of R packages for data cleaning (or wrangling), analysis, and visualization. The installation process will run in the Console pane and may take a few minutes.


To learn more about some of the basics of R programming, please watch the step-by-step walkthrough in the video above (timestamp 19:17).


Step 4: Run the code to create the data visualization

  1. Under the comment ‘# Change these two lines’, specify the state you wish to create a bar graph for.

  2. Check the text assigned to the variable ‘file_name’ to see if it matches the name of the Excel file you downloaded. If the file name is different, please update the code next to the variable to match the name of the file.

  3. Run the rest of the code by selecting it and either clicking ‘Run’ or pressing Ctrl + Enter. (This should generate the bar graph and save a .png file under the ‘Files’ pane. You should also see a preview of the graph in the bottom right under ‘Plots’.)

  4. Click on the .png file in the Files pane to open the image in your browser → right-click on the image to save to your computer.



The final data visualization displays:

  • the U.S. national rate of first-trimester prenatal care

  • the state rate

  • the county(ies) with the lowest rate in the state

  • the county(ies) with the highest rate in the state

  • a title and caption explaining the data and the context of the visualization


For example, in Texas in 2020-2022 (please see the example graph below):

  • Val Verde County has one of the lowest rates (about 42%) of early prenatal care.

  • Williamson County has one of the highest rates (about 83.3%).










Instructors


Teresa Tse, MS, Tutorial Instructor
Teresa Tse, MS, Tutorial Instructor

Teresa Tse, MS

Public Health Data Analyst


Teresa Tse uses R every week to support the data and epidemiology teams of a metropolitan public health department. With a background in biomedical engineering, Teresa has a passion for using programming, research, and data analysis skills to help improve health outcomes. Teresa is a long-time contributor to BroadStreet Institute as a training program manager on the Maternal and Infant Health Track.


Shamini De Silva, BSc, Tutorial Instructor
Shamini De Silva, BSc, Tutorial Instructor

Shamini V De Silva

Program Planner, BroadStreet Institute


Shamini is a BroadStreet Program Planner and aspiring researcher learning RStudio. With a background in Biomedical Science and experience working in Clinical Research, Shamini has realized the potential and impact of high-quality data and the growing demand for data handling and analysis skills. As Shamini learns R, she is sharing that learning with others.



 
 

The BroadStreet Institute is a registered 501(c)3. We are a growing community of volunteer data enthusiasts who believe that good data can heal the world. Volunteer teams manage the Community Health Impact Fund. All are welcome to give, volunteer, and to join our community.

We believe that good data can heal the world. Our vision is a healthy world for all. Our mission is to empower the next generation of leaders in community health through training in tools and skills for data-guided decision-making.

 

We are proud to have The BroadStreet Data Co-op as a major partner and sponsor. Website made with 🤍 in Milwaukee.

© 2025 by BroadStreet Institute

SITE CONTENT:

We send information on big events and updates. We respect your inbox and your privacy. This email will only be used to share our Newsletter.

CONNECT WITH US!

  • Instagram
  • LinkedIn
  • TikTok
  • Youtube
  • bluesky
  • Threads
  • X
  • Reddit
  • Facebook
  • GitHub
bottom of page