This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
geom_glowing_area <- function( | |
alpha = 1, | |
size = 1.5, | |
glow_alpha = 0.05, | |
layers = 10, | |
glow_size = .65){ | |
geoms <- list(ggplot2::geom_area(alpha = .5, position = "identity",color = "#08f7fe")) | |
for(i in (layers+1):1){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
score_cindex <- function( | |
zip_path, # zip file path | |
truth # in memory R object | |
){ | |
library("pec") # pec functions don't work without the lib loaded :( | |
files_present <- zip::zip_list(zip_path)$filename | |
# Check files present |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
score_auc <- function( | |
predictions, | |
truth | |
){ | |
if (!"patientid" %in% names(predictions)) stop("patientid missing from predictions") | |
if (!"prediction" %in% names(predictions)) stop("prediction missing from predictions") | |
if (!"patientid" %in% names(truth)) stop("patientid missing from truth") | |
if (!"has_long_covid_diag" %in% names(truth)) stop("has_long_covid_diag missing from truth") | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get_cindex <- function( | |
predictions = NULL, | |
test_truth = NULL | |
){ | |
start_time <- Sys.time() | |
# Prep data | |
predictions_names <- c("patientid","prediction" ) | |
if(!identical(predictions_names,names(predictions))) stop(paste( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# go to https://github.com/FortAwesome/Font-Awesome/tree/master/webfonts | |
# and install fa-solid-900.ttf, fa-regular-400.ttf and fa-brands-400.ttf | |
# then run extrafont::font_import() | |
library(tidyverse) | |
library(ggplot2) | |
library(waffle) | |
extrafont::loadfonts() | |
# From LEAP supplemental appendix |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is the server logic for a Shiny web application. | |
# | |
# Google sheets connection | |
## prepare the OAuth token and set up the target sheet: | |
## - do this interactively | |
## - do this EXACTLY ONCE | |
# shiny_token <- gs_auth() # authenticate w/ your desired Google identity here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
latlon_1 | latlon_2 | minutes | metres | |
---|---|---|---|---|
52.209025,0.118255 | 52.204115,0.11827 | 8.5 | 692 | |
52.209025,0.118255 | 52.213738,0.124159 | 9.4 | 771 | |
52.209025,0.118255 | 52.204222,0.120324 | 8.2 | 658 | |
52.209025,0.118255 | 52.207309,0.124159 | 7.8 | 650 | |
52.209025,0.118255 | 52.204932,0.127807 | 13.7 | 1130 | |
52.209025,0.118255 | 52.198334,0.142623 | 28.1 | 2308 | |
52.209025,0.118255 | 52.193371,0.133181 | 25.5 | 2080 | |
52.209025,0.118255 | 52.21817,0.146081 | 30.4 | 2453 | |
52.209025,0.118255 | 52.230666,0.138805 | 41.3 | 3348 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jb_pubdistance <- function( | |
v_pubs=c("The Cambridge Brew House","The Cambridge Blue", | |
"King Street Run P.H.","The Elm Tree","The Regal"), | |
v_location="Cambridge, UK", | |
v_zoom=13, | |
listpubs=FALSE, | |
cam_pubs=TRUE, | |
crow_distances=FALSE, | |
units="minutes"){ | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name | type | rating | lat | lon | |
---|---|---|---|---|---|
Baron Of Beef | Pub/bar/nightclub | 4 | 52.209025 | 0.118255 | |
Bath House | Pub/bar/nightclub | 4 | 52.204115 | 0.11827 | |
Boathouse P.H. | Pub/bar/nightclub | 4 | 52.213738 | 0.124159 | |
BRB The Cow | Pub/bar/nightclub | 4 | 52.204222 | 0.120324 | |
Champion Of The Thames | Pub/bar/nightclub | 5 | 52.207309 | 0.124159 | |
Clarendon Arms | Pub/bar/nightclub | 5 | 52.204932 | 0.127807 | |
Earl of Beaconsfield | Pub/bar/nightclub | 5 | 52.198334 | 0.142623 | |
Earl Of Derby | Pub/bar/nightclub | 5 | 52.193371 | 0.133181 | |
Green Dragon Public House | Pub/bar/nightclub | 5 | 52.21817 | 0.146081 |
NewerOlder