Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# See ?reactive for meanings of x, env, quoted, and domain.
# paused indicates the starting state of the pauseable reactive.
pauseableReactive <- function(x, env = parent.frame(), quoted = FALSE,
priority = 0, domain = shiny::getDefaultReactiveDomain(), paused = FALSE) {
shiny::installExprFunction(x, "func", eval.env = env, quoted = quoted)
vals <- shiny::reactiveValues(value = NULL)
obs <- shiny::observe(vals$value <- func(), priority = priority,
domain = domain, suspended = paused)
return(structure(
library(shiny)
shinyServer(function(input, output, session) {
# The number of iterations to perform
maxIter <- 50
# Track the start and elapsed time
startTime <- Sys.time()
output$elapsed <- renderText({
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 2.
"doi","school","ti","au","url","details_url","py","j9","so","tc","score","mendeley","connotea","citeulike","readers_count","cited_by_gplus_count","cited_by_fbwalls_count","cited_by_posts_count","cited_by_tweeters_count","cited_by_accounts_count","cited_by_feeds_count","cited_by_videos_count","cited_by_delicious_count","cited_by_rdts_count","cited_by_forum_count","cited_by_qs_count","cited_by_rh_count","cited_by_msm_count"
"10.1001/jama.2012.347","SCI","One vs Three Years of Adjuvant Imatinib for Operable Gastrointestinal Stromal Tumor A Randomized Trial","Joensuu, H; Eriksson, M; Hall, KS; Hartmann, JT; Pink, D; Schutte, J; Ramadori, G; Hohenberger, P; Duyster, J; Al-Batran, SE; Schlemmer, M; Bauer, S; Wardelmann, E; Sarlomo-Rikala, M; Nilsson, B; Sihto, H; Monge, OR; Bono, P; Kallio, R; Vehtari, A; Leinonen, M; Alvegard, T; Reichardt, P","http://dx.doi.org/10.1001/jama.2012.347","http://www.altmetric.com/details.php?citation_id=670011","2012","JAMA-J AM MED ASSOC","JAMA-JOURNAL OF THE AMERICAN MEDICAL ASSOCI
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 2.
"doi","school","ti","au","url","details_url","py","j9","so","tc","score","mendeley","connotea","citeulike","readers_count","cited_by_gplus_count","cited_by_fbwalls_count","cited_by_posts_count","cited_by_tweeters_count","cited_by_accounts_count","cited_by_feeds_count","cited_by_videos_count","cited_by_delicious_count","cited_by_rdts_count","cited_by_forum_count","cited_by_qs_count","cited_by_rh_count","cited_by_msm_count"
"10.1001/jama.2012.347","SCI","One vs Three Years of Adjuvant Imatinib for Operable Gastrointestinal Stromal Tumor A Randomized Trial","Joensuu, H; Eriksson, M; Hall, KS; Hartmann, JT; Pink, D; Schutte, J; Ramadori, G; Hohenberger, P; Duyster, J; Al-Batran, SE; Schlemmer, M; Bauer, S; Wardelmann, E; Sarlomo-Rikala, M; Nilsson, B; Sihto, H; Monge, OR; Bono, P; Kallio, R; Vehtari, A; Leinonen, M; Alvegard, T; Reichardt, P","http://dx.doi.org/10.1001/jama.2012.347","http://www.altmetric.com/details.php?citation_id=670011","2012","JAMA-J AM MED ASSOC","JAMA-JOURNAL OF THE AMERICAN MEDICAL ASSOCI

Inspired by Trulia Trends - but with code and using SVG.

Example data shows concurrent user sessions over time, taken from a development environment.

# <- Start of bit by Tony Hirst (@psychemedia) see http://blog.ouseful.info/2013/01/09/wordpress-stats-in-r/
#Wordpress Stats
##---------------
#Wordpress Stats API docs (from http://stats.wordpress.com/csv.php)
#You can get a copy of your API key (required) from Akismet:
#Login with you Wordpress account: http://akismet.com/account/
#Resend API key: https://akismet.com/resend/
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")
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")

Using Google Maps API and R

This script uses RCurl and RJSONIO to download data from Google's API to get the latitude, longitude, location type, and formatted address

library(RCurl)
library(RJSONIO)
library(plyr)