library(tidyverse) # for the plot only
# required librariers that need to be installed (not loaded!): quantmod, dplyr, tibble
# (the latter two are in the tidyverse anyway)
#' Downloads stock data from yahoo finance etc. using quantmod::getSymbols
#'
#' @param tickers a vector of tickers
#' @param from start date
#' @param to end date
The following script outlines how we can use git-hooks for continuous deployment (when you push your git repository, it will automatically be deployed to the server).
Note, this script is heavily based on but slightly extends this gist, see also this explanation.
Basic idea: using git-hooks to copy the files on a target machine from a remote git repository to a specific target location.
For this, we need multiple components:
- On the target machine (the production server)
library(tidymodels)
#> ── Attaching packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────────── tidymodels 0.1.0 ──
#> ✓ broom 0.5.5 ✓ recipes 0.1.9
#> ✓ dials 0.0.4 ✓ rsample 0.0.5
#> ✓ dplyr 0.8.5 ✓ tibble 2.1.3
#> ✓ ggplot2 3.3.0 ✓ tune 0.0.1
#> ✓ infer 0.5.1 ✓ workflows 0.1.1
#> ✓ parsnip 0.0.5 ✓ yardstick 0.0.6
#> ✓ purrr 0.3.3
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
library(shiny) | |
library(promises) | |
library(future) | |
plan(multiprocess) | |
long_running_function <- function(sleep = 3) { | |
Sys.sleep(sleep) | |
"Finished long_running_function()" | |
} |
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
library(shinydashboard) | |
library(rintrojs) | |
add_class <- function(x, class) { | |
x$attribs <- append(x$attribs, list(class = class)) | |
x | |
} | |
# # Alternatively, override the functions of shiny/shinydashboard | |
# menuItem <- function(text, tabName, ...) { |
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
``` r | |
library(shiny) | |
library(magrittr) # for the pipe | |
library(shinydashboard) | |
#> | |
#> Attaching package: 'shinydashboard' | |
#> The following object is masked from 'package:graphics': | |
#> | |
#> box |
library(sf)
#> Linking to GEOS 3.8.0, GDAL 3.1.2, PROJ 7.0.0
library(leaflet)
library(leafem)
url <- "https://raw.githubusercontent.com/bjornharrtell/flatgeobuf/3.0.1/test/data/UScounties.fgb"
map <- st_read(url)
#> Reading layer `UScounties' from data source `https://raw.githubusercontent.com/bjornharrtell/flatgeobuf/3.0.1/test/data/UScounties.fgb' using driver `FlatGeobuf'
#> Simple feature collection with 3221 features and 6 fields
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
library(shiny) | |
library(tidyverse) | |
library(glue) | |
library(DT) | |
df <- mtcars %>% | |
rownames_to_column("car") %>% | |
select(car, everything()) | |
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
library(tidyverse) | |
library(sf) | |
library(spData) | |
library(gganimate) | |
data(world) | |
# see also: https://proj.org/operations/projections/index.html | |
projs <- list( | |
"Mercator" = "+proj=merc", |
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
library(shiny) | |
library(shiny.tailwind) | |
# Define Helper functions for open modal btn and modal ===== | |
#' Creates a button to open a Modal Dialog | |
#' | |
#' @param btn_id ID of the button | |
#' @param btn_label Label for the button | |
#' @param btn_class Classes to style the button |