Skip to content

Instantly share code, notes, and snippets.

View marcionicolau's full-sized avatar

Marcio Nicolau marcionicolau

View GitHub Profile
@marcionicolau
marcionicolau / R2jags-sample.R
Created August 8, 2012 16:26
R2jags sample use
require(R2jags)
@marcionicolau
marcionicolau / run_shinyExt.R
Created December 12, 2012 01:04
run shinyExt experimenter example
require(devtools)
install_github('shinyExt','marcionicolau')
require(shinyExt)
shiny::runApp(system.file('examples/experimenter',package='shinyExt'))
doInstall <- TRUE # Change to FALSE if you don't want packages installed.
toInstall <- c("ReadImages", "reshape", "ggplot2")
if(doInstall){install.packages(toInstall, repos = "http://cran.r-project.org")}
lapply(toInstall, library, character.only = TRUE)
# Image URL:
allImageURLs <- c("http://media.charlesleifer.com/blog/photos/thumbnails/akira_940x700.jpg",
"http://upload.wikimedia.org/wikipedia/commons/thumb/e/ec/Mona_Lisa%2C_by_Leonardo_da_Vinci%2C_from_C2RMF_retouched.jpg/402px-Mona_Lisa%2C_by_Leonardo_da_Vinci%2C_from_C2RMF_retouched.jpg",
"http://upload.wikimedia.org/wikipedia/commons/thumb/e/e9/Official_portrait_of_Barack_Obama.jpg/441px-Official_portrait_of_Barack_Obama.jpg",
"http://cache.boston.com/universal/site_graphics/blogs/bigpicture/obama_11_05/obama22_16604051.jpg",
doInstall <- TRUE # Change to FALSE if you don't want packages installed.
toInstall <- c("ReadImages", "reshape", "ggplot2")
if(doInstall){install.packages(toInstall, repos = "http://cran.r-project.org")}
lapply(toInstall, library, character.only = TRUE)
# Image URL:
allImageURLs <- c("http://media.charlesleifer.com/blog/photos/thumbnails/akira_940x700.jpg",
"http://upload.wikimedia.org/wikipedia/commons/thumb/e/ec/Mona_Lisa%2C_by_Leonardo_da_Vinci%2C_from_C2RMF_retouched.jpg/402px-Mona_Lisa%2C_by_Leonardo_da_Vinci%2C_from_C2RMF_retouched.jpg",
"http://upload.wikimedia.org/wikipedia/commons/thumb/e/e9/Official_portrait_of_Barack_Obama.jpg/441px-Official_portrait_of_Barack_Obama.jpg",
"http://cache.boston.com/universal/site_graphics/blogs/bigpicture/obama_11_05/obama22_16604051.jpg",
.Rproj.user
.Rhistory
.RData
*.Rproj
long-*
library(shiny)
# load a very small projects file
# Eventually the idea is to have a database link to SQLite or access
projects=data.frame(pid=c(1,2,3,4,5),project=c("proj1","proj2","proj3","proj4","proj5"))
# Define server logic
shinyServer(function(input, output) {
# if Projects -> View Projects is selected, this outputs the lists in dataframe projects
@marcionicolau
marcionicolau / server.R
Created January 15, 2013 18:57 — forked from jcheng5/server.R
Show Elapsed Time in shiny process
library(shiny)
shinyServer(function(input, output) {
output$intense <- reactivePrint(function() {
if(input$panel==2){
Sys.sleep(10)
return('Finished')
}else({return(NULL)})
})
@marcionicolau
marcionicolau / global.R
Created January 15, 2013 20:06 — forked from dempseydata/global.R
AB2 Test
###############################################
##
## 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
@marcionicolau
marcionicolau / instructR.R
Created January 16, 2013 12:05 — forked from rdabbler/instructR.R
Learning R with Shiny
# Here a set of instructions corresponding to each code lesson is made into a dataset codelist
ID=as.numeric() # id of code lesson
instruct=as.character() # instructions for code lesson
subhead=as.character() # subheading for code lesson
i=1
ID[i]=i
subhead[i]="Simple R Expressions: Addition"
instruct[i]=paste('Try simple math','Type the command below','','1+1','',sep="\n")
@marcionicolau
marcionicolau / ace-shiny.css
Created January 16, 2013 12:22
knitr shiny example - by yihui
#proxy {
position: absolute;
top: 0;
right: 0;
display: none;
}
#notebook {
position: absolute;
width: 600px;