diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9e0aa8b..47f8c8a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -28,7 +28,7 @@ jobs: - name: Run Quarto in Docker container run: | - docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace mewu/data_access:latest bash -c "run_quarto_publish.sh" + docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace mewu/data_access:latest bash -c "./run_quarto_publish.sh" - name: Generate Index HTML run: | diff --git a/r/samples/shinylive_demo/shiny_demo.ipynb b/r/samples/shinylive_demo/shiny_demo.ipynb deleted file mode 100644 index dc094ef..0000000 --- a/r/samples/shinylive_demo/shiny_demo.ipynb +++ /dev/null @@ -1,205 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 7, - "id": "88b29033-79a1-40f1-a755-8f10e67f3442", - "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Installing package into ‘/usr/local/lib/R/site-library’\n", - "(as ‘lib’ is unspecified)\n", - "\n", - "Installing package into ‘/usr/local/lib/R/site-library’\n", - "(as ‘lib’ is unspecified)\n", - "\n", - "Installing package into ‘/usr/local/lib/R/site-library’\n", - "(as ‘lib’ is unspecified)\n", - "\n", - "Installing package into ‘/usr/local/lib/R/site-library’\n", - "(as ‘lib’ is unspecified)\n", - "\n", - "Installing package into ‘/usr/local/lib/R/site-library’\n", - "(as ‘lib’ is unspecified)\n", - "\n", - "also installing the dependencies ‘colorspace’, ‘farver’, ‘labeling’, ‘munsell’, ‘RColorBrewer’, ‘viridisLite’, ‘gtable’, ‘isoband’, ‘scales’\n", - "\n", - "\n" - ] - } - ], - "source": [ - "install.packages(\"shinylive\")\n", - "install.packages(\"shiny\")\n", - "install.packages(\"shinyWidgets\")\n", - "install.packages(\"dplyr\")\n", - "install.packages(\"ggplot2\")" - ] - }, - { - "cell_type": "markdown", - "id": "e03329ba-510e-4f00-bd20-6ada312e5d0d", - "metadata": {}, - "source": [ - "---\n", - "title: \"Template for r-shinylive Quarto document (Covid Example)\"\n", - "format:\n", - " html:\n", - " resources: \n", - " - shinylive-sw.js\n", - "filters:\n", - " - shinylive\n", - "---" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "id": "09f6b537-b184-4ea6-b9b9-190f96207cdb", - "metadata": {}, - "outputs": [], - "source": [ - "options(timeout = 6000)\n", - "library(shiny)\n", - "library(dplyr)\n", - "library(ggplot2)\n", - "library(shinyWidgets)\n", - "\n", - "# Download real COVID data for Washington state counties from the New York Times GitHub repo\n", - "covid_url <- \"https://raw.githubusercontent.com/nytimes/covid-19-data/master/us-counties.csv\"\n", - "covid_data <- read.csv(covid_url)" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "id": "0a03f7b5-18cf-4df3-98b7-657cd171731e", - "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "\n", - "Listening on http://127.0.0.1:7477\n", - "\n" - ] - } - ], - "source": [ - "\n", - "# Filter for Washington state and prepare the data\n", - "washington_covid_data <- covid_data %>%\n", - " filter(state == \"Washington\") %>%\n", - " select(date, county, cases) %>%\n", - " mutate(year_month = format(as.Date(date), \"%Y%m\")) # Create year_month column\n", - "\n", - "# Create a vector of unique year_month values from the dataset\n", - "valid_year_months <- sort(unique(washington_covid_data$year_month))\n", - "valid_year_months_index <- seq_along(valid_year_months)\n", - "\n", - "# Define the UI\n", - "ui <- fluidPage(\n", - " titlePanel(\"COVID Case Counts by Month-Year in Washington Counties\"),\n", - " \n", - " # Use fluidRow to place the slider at the top, spanning the entire page width\n", - " fluidRow(\n", - " column(12, # 12 columns to span full width\n", - " sliderTextInput(\"selected_year_month\", \n", - " \"Select Year and Month:\", \n", - " choices = valid_year_months, # Use year-month values directly\n", - " selected = \"202001\", # Start with the first year-month\n", - " animate = animationOptions(interval = 1000, loop = FALSE))\n", - " )\n", - " ),\n", - " \n", - " # Main panel for the plot below the slider\n", - " fluidRow(\n", - " column(12, # This will also span the entire width\n", - " plotOutput(\"histogramPlot\")\n", - " )\n", - " )\n", - ")\n", - "\n", - "\n", - "# Define the server\n", - "server <- function(input, output) {\n", - " output$histogramPlot <- renderPlot({\n", - " filtered_data <- washington_covid_data %>%\n", - " filter(year_month == as.character(input$selected_year_month)) %>%\n", - " group_by(county) %>%\n", - " summarize(total_cases = max(cases, na.rm = TRUE)) # Get max case count for each county in the selected year_month\n", - " \n", - " ggplot(filtered_data, aes(x = county, y = total_cases)) +\n", - " geom_bar(stat = \"identity\", fill = \"steelblue\") +\n", - " labs(title = paste(\"COVID Cases in\", input$selected_year_month),\n", - " x = \"County\", \n", - " y = \"Total Case Count\") +\n", - " theme_minimal() +\n", - " theme(axis.text.x = element_text(angle = 45, hjust = 1))\n", - " })\n", - "}\n", - "\n", - "# Run the Shiny app\n", - "shinyApp(ui = ui, server = server)" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "id": "d050a599-2d6c-4338-9d6f-5ed08de7f98e", - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "'/workspaces/quarto_demo/.devcontainer'" - ], - "text/latex": [ - "'/workspaces/quarto\\_demo/.devcontainer'" - ], - "text/markdown": [ - "'/workspaces/quarto_demo/.devcontainer'" - ], - "text/plain": [ - "[1] \"/workspaces/quarto_demo/.devcontainer\"" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "getwd()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "bf722ea2-9268-4a24-a275-4a3cf4c7c766", - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "R", - "language": "R", - "name": "ir" - }, - "language_info": { - "codemirror_mode": "r", - "file_extension": ".r", - "mimetype": "text/x-r-source", - "name": "R", - "pygments_lexer": "r", - "version": "4.4.1" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -}