Skip to content

Instantly share code, notes, and snippets.

@agberg
agberg / dynamic_shiny_i_o_example.R
Created December 28, 2017 23:30
The first half of a dynamic filtering Shiny application.
library(shiny)
library(stringr)
# Module UI function
fieldSelectorInput <- function(id) {
# Create a namespace function using the provided id
ns <- NS(id)
tags$div(id = ns("id"),
tagList(
@MarkEdmondson1234
MarkEdmondson1234 / dynamicSelectShinyModule.R
Last active November 21, 2020 00:09
Shiny modules for creating dynamic SelectInputs
library(shiny)
#' Safe subset
#'
#' @param df Dataframe
#' @param column One name of column to subset within
#' @param subset Vector of entries in column to subset to
#'
#' If column not in df, returns back the df
safeSubset <- function(df, column, subset){
@derekmcloughlin
derekmcloughlin / stats_equations.Rmd
Last active June 25, 2024 17:26
Useful Latex Equations used in R Markdown for Statistics
---
title: "Sample Equations used in Statistics"
output: html_document
---
### Summations
### Without Indices
$\sum x_{i}$
@Ray901
Ray901 / Login.R
Last active May 15, 2021 00:23
R shiny app userLogin
#### Log in module ###
PASSWORD <- data.frame(
Brukernavn = c("ray","gil"),
Passord = c("0000","1234")
)
output$uiLogin <- renderUI({
if (USER$Logged == FALSE) {
wellPanel(
@drewgriffith15
drewgriffith15 / FibonacciRetracements.R
Created January 16, 2015 20:55
Fibonacci Retracements in R
###############################################################################
# Load Systematic Investor Toolbox (SIT)
# http://systematicinvestor.wordpress.com/systematic-investor-toolbox/
###############################################################################
setInternet2(TRUE)
con = gzcon(url('http://www.systematicportfolio.com/sit.gz', 'rb'))
source(con)
close(con)
#library(griffun)
load.packages('forecast,quantmod,lmtest,TTR')
@psychemedia
psychemedia / README.md
Last active May 4, 2024 22:33
How to load desktop CSV file into R/Sshiny app.

Minimal R shiny app demonstrating:

  1. how to upload a CSV file into an R/shiny app
  2. how to automatically populate list selectors based on column headers
  3. how to use optional list selectors
  4. how to populate a list selector with column names of numerical columns only
  5. how to use an action button to trigger an event when you're ready to do so

@withr
withr / server.R
Last active January 8, 2025 22:43
Encrypt password with md5 for Shiny-app.
library(shiny)
library(datasets)
Logged = FALSE;
PASSWORD <- data.frame(Brukernavn = "withr", Passord = "25d55ad283aa400af464c76d713c07ad")
# Define server logic required to summarize and view the selected dataset
shinyServer(function(input, output) {
source("www/Login.R", local = TRUE)
observe({
if (USER$Logged == TRUE) {
@wch
wch / server.r
Last active September 8, 2023 20:25
Shiny example: dynamic input fields
data_sets <- c("mtcars", "morley", "rock")
shinyServer(function(input, output) {
# Drop-down selection box for which data set
output$choose_dataset <- renderUI({
selectInput("dataset", "Data set", as.list(data_sets))
})
# Check boxes