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(ggplot2) | |
makePlot <- function(xvar, yvar) { | |
ggplot(iris, aes_string(xvar, yvar)) + geom_point() | |
} | |
ui <- fluidPage( | |
selectInput("xvar", "X variable", choices = names(iris), selected = names(iris)[1]), | |
selectInput("yvar", "Y variable", choices = names(iris), selected = names(iris)[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
makeReactiveTrigger <- function() { | |
rv <- shiny::reactiveValues(a = 0) | |
list( | |
depend = function() { | |
rv$a | |
}, | |
trigger = function() { | |
rv$a <- shiny::isolate(rv$a + 1) | |
} | |
) |
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
[{"CountryList": ["Austria", "Germany", "Italy", "Spain", "United Kingdom"], "Sector3": "Commercial Leases"}, {"CountryList": ["Belgium", "France", "Germany", "Ireland", "Italy", "Netherlands", "Portugal", "Spain", "United Kingdom"], "Sector3": "Residential Mortgage"}, {"CountryList": ["Belgium", "France", "Ireland", "Spain", "United Kingdom"], "Sector3": "Credit Card"}, {"CountryList": ["Belgium", "Germany", "Italy", "Portugal", "Spain"], "Sector3": "SME CLO"}, {"CountryList": ["France", "Germany", "Netherlands"], "Sector3": "Auto Leases"}, {"CountryList": ["France", "Germany", "Italy", "Netherlands", "Norway", "Portugal", "Spain", "United Kingdom"], "Sector3": "Auto Loans"}, {"CountryList": ["France", "Germany", "Italy", "Netherlands", "Portugal", "Spain", "Sweden"], "Sector3": "Consumer Loans"}, {"CountryList": ["France", "Portugal", "United Kingdom"], "Sector3": "Mixed Auto Loans and Leases"}, {"CountryList": ["Germany", "Ireland", "Italy", "Spain"], "Sector3": "Consumer and Commercial Leases"}, {"Country |
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
## foo `bar` | |
hello | |
``` | |
x <- 5 | |
``` | |
<p align="center">test</p> |
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
# Connecting using RPostgreSQL works | |
library(RPostgreSQL) | |
con <- dbConnect(dbDriver("PostgreSQL"), | |
host = "localhost", | |
dbname = "postgres", | |
user = "postgres", | |
password = password, | |
port = 5432) | |
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(ggplot2) | |
library(plotly) | |
data <- data.frame(x = rnorm(20), y = runif(20), z = letters[1:20]) | |
p <- ggplot(data, aes(x = x, y = y)) + | |
geom_smooth(method='lm') + | |
geom_point(aes(text = z)) + | |
scale_x_continuous(limits = c(0, 5)) + | |
annotate("text", label = "foo", x=1, y=1) |
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
# production | |
dbConnect( | |
RSQLServer::SQLServer(), | |
server = config$server, | |
database = config$database, | |
properties = list( | |
user = config$uid, | |
password = config$pwd | |
) | |
) |
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
# Clicking on a single point seems to clear the lasso selection. But the opposite is not true: doing a lasso selection still keeps the clicked point information. | |
# To reproduce: | |
# - Click a single point | |
# - Do a lasso selection | |
# - Both are currently visible | |
# - Click a different point | |
# - Now the lasso selection information is gone | |
# - Do a lasso selection again, both are visible again | |
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
# I'm trying to let the user select points and paint them in a certain colour, and if the user clicks on a point then paint that point a different colour. | |
# It looks like the pointNumber and curveNumber data that plotly returns are different for the same points. I'm not sure how curveNumber works, but to me it doesn't make sense yet :) | |
# Any help is appreciated! | |
library(plotly) | |
library(shiny) | |
ui <- fluidPage( | |
plotlyOutput("plot") | |
) |
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) | |
ui <- fluidPage( | |
shinyjs::useShinyjs(), | |
# You have to include this one-liner CSS | |
tags$style(".fullwidth { width: 100% !important; }"), | |
# You need to wrap the sidebarLayout() by a div() and give it an ID | |
div(id = "SOMEID", |
NewerOlder