Skip to content

Instantly share code, notes, and snippets.

trustgame2 <- function(investor_string,trustee_string){
#investor <- get(investor_string, envir = globalenv())
#trustee <- get(trustee_string, envir = globalenv())
investor <- investors[[investor_string]]
trustee <- trustees[[trustee_string]]
investordecision <- NULL
trusteedecision <- trustee[1]
investor[6] <- investor[6]+1
trustee[4] <- trustee[4]+1
if (investor[1]==0) investordecision <- investor[2]
# create blog post
library(markdown)
library(knitr)
knit("blogpost.Rmd")
markdownToHTML("blogpost.md", "blogpost.html", fragment.only = TRUE)
print("hello world")
What is your answer?\n\nYes\nNo\nMaybe
What is your reply?\n\nOne\nTwo\nThree
something
with
newlines
@corynissen
corynissen / a.txt
Last active February 26, 2016 18:46
unicode test
i💙you
q r s t u v w x y z
1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 bla
2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 blubb
@corynissen
corynissen / index.html
Created September 14, 2015 17:50
Level 1 Trauma Centers
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script src="data:application/x-javascript,%28function%28%29%20%7B%0A%20%20%2F%2F%20If%20window%2EHTMLWidgets%20is%20already%20defined%2C%20then%20use%20it%3B%20otherwise%20create%20a%0A%20%20%2F%2F%20new%20object%2E%20This%20allows%20preceding%20code%20to%20set%20options%20that%20affect%20the%0A%20%20%2F%2F%20initialization%20process%20%28though%20none%20currently%20exist%29%2E%0A%20%20window%2EHTMLWidgets%20%3D%20window%2EHTMLWidgets%20%7C%7C%20%7B%7D%3B%0A%0A%20%20%2F%2F%20See%20if%20we%27re%20running%20in%20a%20viewer%20pane%2E%20If%20not%2C%20we%27re%20in%20a%20web%20browser%2E%0A%20%20var%20viewerMode%20%3D%20window%2EHTMLWidgets%2EviewerMode%20%3D%0A%20%20%20%20%20%20%2F%5Cbviewer%5Fpane%3D1%5Cb%2F%2Etest%28window%2Elocation%29%3B%0A%0A%20%20%2F%2F%20See%20if%20we%27re%20running%20in%20Shiny%20mode%2E%20If%20not%2C%20it%27s%20a%20static%20document%2E%0A%20%20%2F%2F%20Note%20that%20static%20widgets%20can%20appear%20in%20both%20Shiny%20and%20static%2
install.packages("devtools")
library("devtools")
install.packages("httr")
install.packages("RJSONIO")
install.packages("stringr")
install_github("corynissen/fitbitScraper")
library("fitbitScraper")
start_date <- "2015-06-01"
end_date <- "2015-07-21"
date_seq <- as.character(seq(as.Date(start_date), as.Date(end_date), by="1 day"))
@corynissen
corynissen / server.R
Last active August 29, 2015 14:23
leaflet shiny
library("leaflet")
server <- function(input, output) {
output$map <- renderLeaflet({
leaflet() %>%
setView(lat=41.88043, lng=-87.63609, zoom=18) %>%
addTiles()
})
observeEvent(input$map_click, {