Skip to content

Instantly share code, notes, and snippets.

View gist:518321b7fb2e9e08c0c15f3081199416
library(tidyverse)
# produce data
pharmacy_sub <- pharmacy %>%
filter(Site1 == "Site C", NSVCode == "Drug A")
daily_data <- phaRmacyForecasting:::make_tsibble(pharmacy_sub, frequency = "Daily")
View evaluation.R
# this is old code! I do not advocate doing any of the below :-)
rm(list=ls())
library(psych)
count.NAS=function(x) length(which(is.na(x)))
ASPECT=read.csv("ASPECT.csv")
HONOS=read.csv("HONOS.csv")
ESSENCES=read.csv("ESSENCES.csv")
View loop_penguins.Rmd
---
title: "Loop demo"
author: "Chris Beeley"
date: "21/04/2021"
output: html_document
params:
species: NA
---
```{r setup, include=FALSE}
@ChrisBeeley
ChrisBeeley / app.R
Created Mar 12, 2021
Demo of reactive data and UI
View app.R
library(palmerpenguins)
library(tidyverse)
# Define UI for application that draws a histogram
ui <- fluidPage(
# Application title
titlePanel("Reactive example"),
sidebarLayout(
View minimal.Rmd
---
title: "Basic RMarkdown Shiny"
author: "Chris Beeley"
output: html_document
runtime: shiny
---
# Example RMarkdown document
This is an interactive document written in *markdown*. As you can see it is easy to include:
@ChrisBeeley
ChrisBeeley / server.R
Created Dec 22, 2015
Minimal example of a full Shiny application
View server.R
library(shiny) # load Shiny at the top of both scripts
shinyServer(function(input, output) { # define application in here
output$textDisplay <- renderText({ # mark function as reactive
# and assign to output$textDisplay for passing to ui.R
paste0("You said '", input$comment, # from the text
"'. There are ", nchar(input$comment), # input control as
@ChrisBeeley
ChrisBeeley / app.R
Created Apr 3, 2020
Test to see how app.R behaves the first time it runs and on subsequent runs
View app.R
library(shiny)
library(tidyverse)
library(DT)
load("ae_attendances.RData")
Sys.sleep(10)
# filter to random 10 Trusts with a decent amount of data in
View survey_munge
### Data load
library(tidyverse)
library(RMySQL)
library(readxl)
main <- read_excel("JISC_05-02-20.xlsx", skip = 1) %>%
rename(TeamC = `Team Number`, Date = CompletionDate) %>%
select(-starts_with("1."), -starts_with("2."), -starts_with("3."), -starts_with("4."))
View List of NHS relevant GitHubs
https://github.com/HFAnalyticsLab
https://github.com/codonlibrary
https://github.com/royal-free-london
https://github.com/PublicHealthEngland
https://github.com/nhsuk
@ChrisBeeley
ChrisBeeley / server.R
Last active Oct 2, 2019
Demo to show widget types, return values and data types in Shiny
View server.R
function(input, output) {
output$textDisplay <- renderTable({
getMat = matrix(
c(paste(input$checkGroup, collapse=','), class(input$checkGroup),
input$boxInput, class(input$boxInput),
as.character(as.Date(input$theDate, origin = "1970-01-01")), class(input$theDate),
paste(as.character(as.Date(input$dateRange[[1]], origin = "1970-01-01")),
as.character(as.Date(input$dateRange[[2]], origin = "1970-01-01")),