Harold Nelson
2026-11-17
Use the command getwd() in the console in RStudio to identify your current working directory.
In RStudio, click on file, then new file and select Shiny Web App.
Give the name “Presidents”. Make sure that you are pointing to your current working directory.
Select single file and click on create.
You can run the demo application by clicking the ‘Run App’ button above.
In the app.R file delete everything. . We will start with a very simple app and add to it. We are working with the indicators of presidential performane. The file indicators.Rdata is available in Moodle. Put a copy of it in the subfolder
In the UI, create an input for a piece of text. The name of the variable is “indicator”. The description is “Select an Indicator”.
Create a fluidPage and add this input.
Use the following prompt for Gemini, Claude, or ChatGPT.
I want to create a shiny app to display performance indicators for US Presidents. The data is in an R Data frame indicators in the Rdata file “indicators.Rdata”.
The available indicators are:
The data is quarterly from the beginning of 1981 to the third quarter of 2026.
Other variables in the dataframe are:
Date: the date of the quarter in Date format.
President: The name of the president.
The shiny app should allow the user to select an indicator.
It should use the following code to produce a graph. This code uses infcpi for an example.
indicators %>%
ggplot(aes(x = Date,
y = infcpi,
color = President)) +. geom_point() +. ggtitle(“Annualized Rate of
Inflation”)
Copy the code from the AI into the app.R file.
In Moodle, Click on Shiny Assistant. Ask “In RStudio, how do I deploy a shiny app to Posit Connect Cloud?”
Click on Run app, then publish. Select Posit Connect Cloud.
In PCC, click on home. Go to the app and click on the “angle and box” icon to get a link to the deployed app.
https://01a1eb1a-89da-0dfe-8ebb-489268cb0d1e.share.connect.posit.cloud/