a <- c("Yes please", "Not this one", "This is also good")
stringr::str_detect(a, "Yes")
#> [1] TRUE FALSE FALSE
stringr::str_detect(a, "Yes") | stringr::str_detect(a, "good")
#> [1] TRUE FALSE TRUE
stringr::str_detect(a, "Yes|good")
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
--- | |
title: "Test document" | |
author: "Chris Beeley" | |
date: "20 December 2017" | |
output: pdf_document | |
--- | |
```{r setup, include=FALSE} | |
knitr::opts_chunk$set(echo = TRUE) | |
``` |
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
--- | |
title: "Minimal example" | |
author: "Chris Beeley" | |
date: "1 September 2015" | |
output: word_document | |
--- | |
```{r setup, include=FALSE} | |
knitr::opts_chunk$set(echo = TRUE) |
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(sparkline) | |
library(formattable) | |
library(dplyr) | |
x = c(0, rep(1000, 5), rep(1000.000001, 5)) | |
res <- mtcars |> | |
mutate(summary = as.character( | |
htmltools::as.tags( | |
sparkline(x, type = "bar", |
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
# Shiny app with 3 fields that the user can submit data for | |
ui <- fluidPage( | |
DT::dataTableOutput("responses", width = 300), tags$hr(), | |
textInput("name", "Name", ""), | |
checkboxInput("used_shiny", "I've built a Shiny app in R before", FALSE), | |
sliderInput("r_num_years", "Number of years using R", | |
0, 25, 2, ticks = FALSE), | |
actionButton("submit", "Submit") | |
) |
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
--- | |
title: "Parameterised Reporting" | |
author: "Tina Simms" | |
date: "03/11/2021" | |
output: html_document | |
params: | |
month: | |
label: "Month of the Year" | |
value: January | |
input: select |
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(tidyverse) | |
# produce data | |
pharmacy_sub <- pharmacy %>% | |
filter(Site1 == "Site C", NSVCode == "Drug A") | |
daily_data <- phaRmacyForecasting:::make_tsibble(pharmacy_sub, frequency = "Daily") |
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 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") |
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
--- | |
title: "Loop demo" | |
author: "Chris Beeley" | |
date: "21/04/2021" | |
output: html_document | |
params: | |
species: NA | |
--- | |
```{r setup, include=FALSE} |
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(palmerpenguins) | |
library(tidyverse) | |
# Define UI for application that draws a histogram | |
ui <- fluidPage( | |
# Application title | |
titlePanel("Reactive example"), | |
sidebarLayout( |
NewerOlder