This file contains 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
library(shiny) | |
library(reactable) | |
ui <- fluidPage( | |
reactableOutput("dummy") | |
) | |
server <- function(input, output, session) { | |
data <- tibble::tibble(x = letters[1:3], y = 1:3, z = c(3, 7, 11)) | |
This file contains 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
library(shiny) | |
prepare_party <- function() { | |
tags$script( | |
HTML(' | |
function replaceBody() { | |
document.body.innerHTML = "<h1 style=\\"font-family: Gothic Sans; font-size: 20pt; color: blue;\\">HAPPY BIRTHDAY</h1>"; | |
}; | |
') | |
) |
This file contains 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
```{mermaid} | |
%%{init: { 'logLevel': 'debug', 'theme': 'base', 'gitGraph': {'showBranches': true, 'showCommitLabel':true,'mainBranchName': 'develop', 'mainBranchOrder': 2}} }%% | |
gitGraph | |
commit | |
branch main | |
checkout main | |
commit id: "A" | |
checkout develop | |
commit id: "B" | |
branch rt-add-feature order: 3 |
This file contains 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
# assume tbl is original table | |
ult_parent <- rep(NA_integer_, nrow(tbl)) | |
get_parent_id <- function(tbl, id) { | |
# depends on your implementation | |
} | |
is_ult_parent <- function(tbl, id) { | |
# depends on your implementation | |
} |
This file contains 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 a Plumber API. You can run the API by clicking | |
# the 'Run API' button above. | |
# | |
# Find out more about building APIs with Plumber here: | |
# | |
# https://www.rplumber.io/ | |
# | |
library(plumber) |
This file contains 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
library(tibble) | |
library(ggplot2) | |
library(dplyr) | |
library(tidyr) | |
sim_years <- 7 | |
start_year <- 2014 | |
report_pattern <- c(0.25, 0.45, 0.55, 0.75, 0.9, 0.95, 1) | |
paid_pattern <- c(0.1, 0.25, 0.45, 0.68, 0.85, 0.94, 0.98) | |
# assuming Poisson with lambda = 100, and Lognormal with mu = 7 and sigma = 2 |
This file contains 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 a Shiny web application. You can run the application by clicking | |
# the 'Run App' button above. | |
# | |
# Find out more about building applications with Shiny here: | |
# | |
# http://shiny.rstudio.com/ | |
# | |
library(shiny) |
This file contains 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
# my use case was for time in Zulu (or GMT). This is what the Z at the end of the format is doing. | |
a <- lubridate::now(tzone = "GMT") | |
a_str <- format(a, format = "%FT%TZ" |
This file contains 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
library(GLMsData) #where the flowers dataset comes from | |
library(dplyr) | |
library(ggplot) | |
library(ggtext) | |
flowers %>% | |
group_by(Timing, Light) %>% | |
summarise(expFlowers = mean(Flowers)) %>% | |
ggplot() + | |
aes(x = Light, y = expFlowers, group = Timing, color = Timing) + | |
geom_line(size = 1.5) + |
This file contains 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
library(ggtext) | |
# flowers data from the GLMsData package. | |
flowers %>% | |
group_by(Timing, Light) %>% | |
summarise(expFlowers = mean(Flowers)) %>% | |
ggplot() + | |
aes(x = Light, y = expFlowers, group = Timing, color = Timing) + | |
geom_line(size = 1.5) + | |
geom_point(size = 3) + | |
scale_color_manual(values = c("#d83177", "#6c31d8")) + |
NewerOlder