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
#initialize | |
library(datasets) | |
library(ggplot2) | |
#helper function (convert vector to named list) | |
namel<-function (vec){ | |
tmp<-as.list(vec) | |
names(tmp)<-as.character(unlist(vec)) | |
tmp | |
} |
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
############################################### | |
## | |
## Attempt no 2 at building a shiny web app | |
## for AB Testing use - using global.R | |
## | |
## global.R - loading and defining variables for the global environment | |
## | |
############################################### | |
# Pallette used in some charts as a general indicator color for better or worse that the control group |
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(datasets) | |
library(ggplot2) | |
tg <- ToothGrowth | |
tg$dose <- factor(tg$dose) | |
# Define server logic | |
shinyServer(function(input, output) { | |
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(magrittr) | |
shinyServer(function(input, output, session) { | |
#__________________________________________________________________________________ | |
# The main named list that will be used in many other tasks. | |
listN <- reactiveValues() | |
makeReactiveBinding("listN") | |
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(shinyjs) | |
library(DT) | |
data("cars") | |
ui <- tagList( | |
useShinyjs(), | |
navbarPage("OSD", |
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
# Simple example of exporting UI to another function (this works) | |
library(shiny) | |
tabUI <- function(id) { | |
ns <- NS(id) | |
fluidRow( | |
textOutput(ns("filter")) | |
) | |
} |
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(datasets) | |
shinyServer(function(input, output) { | |
## Inputs; | |
output$uitextInput <- renderUI({ | |
textInput("caption", "Caption:", "Data Summary") | |
}) | |
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
require(shiny) | |
require(rCharts) | |
inputChoices <- c("A", "B", "C", "D") | |
shinyServer(function(input, output, session){ | |
input2Choices <- reactive({ | |
inputChoices[-grep(input$input1, inputChoices)] | |
}) |
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(chron) | |
library(shiny) | |
energy1=c(76.1,77,78.1,78.2,78.8,79.7,79.9,81.1,81.2,81.8,82.8,83.5) | |
cost1=c(7.1,7,7.1,7.2,7.8,7.7,7.9,8.1,8.2,8.8,8.8,8.5) | |
time1=c(20130301,20130401,20130501,20130601,20130701,20130801,20130901,20131001,20131101,20131201,20140101,20140201) | |
time1=as.Date(as.character(time1),format="%Y%m%d") | |
shinymonth=data.frame(time=time1,energy=energy1,cost=cost1) |
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
#StrategicPestTechnologies: Functions | |
#~~~~~~~~~~~Calc trap info~~~~~~~~~~~~ | |
trap.info.func<-function(file){ | |
#Take file | |
#Return: traps, n.traps, ylims, xlims, total.area | |
traps<-read.table(file, header=FALSE) | |
colnames(traps)<-c("ID","X","Y") | |
n.traps<-dim(traps)[1] |
NewerOlder