This file contains hidden or 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
{ | |
"metadata": { | |
"name": "plos_one_analysis" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ |
This file contains hidden or 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
/* Adapted from a .css file that is Copyright (c) 2009-2013 Jeremy Ashkenas | |
* https://github.com/jashkenas/docco | |
* NP modified 02/03/14 | |
* MIT licence */ | |
/*--------------------- Typography ----------------------------*/ | |
@font-face { | |
font-family: 'fleurons'; | |
src: url('http://jashkenas.github.io/docco/resources/linear/public/fonts/fleurons.eot'); | |
src: url('http://jashkenas.github.io/docco/resources/linear/public/fonts/fleurons.eot?#iefix') format('embedded-opentype'), |
This file contains hidden or 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
#!/usr/bin/awk -f | |
# http://stackoverflow.com/a/1729980/3275826 | |
# Make sure this directory/file is in your $PATH | |
# then call as transpose.awk fileName | |
{ | |
for (i=1; i<=NF; i++) { | |
a[NR,i] = $i | |
} | |
} | |
NF>p { p = NF } |
This file contains hidden or 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
# From comments on https://stackoverflow.com/a/19610840/3275826 | |
# and https://stackoverflow.com/a/1395280/3275826 | |
# | |
# Using mget can avoid the problems of having an object with the same name | |
# as the function argument confusing the results, here `x` in the line | |
# `sizes = sapply(list_obj, function(x) object.size(get(x)), simplify = FALSE)` | |
# If you were to use this instead and assigned x to a large enough object, | |
# then the output of this function would be different to a straight object.size(x) call | |
# | |
# object.size can be replaced by pryr::object_size |
This file contains hidden or 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
# Prior to the tutorial make sure that the script below runs without error on your R installation. | |
# What you need is a working installation of Stan: http://mc-stan.org/ . | |
# For installation instructions, see here: | |
# https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started | |
# After installation you should be able to run this script which should output | |
# some summary statistics and some pretty plots, :) | |
# Generating some fake data | |
set.seed(123) |
This file contains hidden or 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
git fetch origin pull/NN/head:prNN ## check the PR number - this is what goes between pull and head. After the : is the name of the branch - makes sense to call it like this prID where ID is PR number | |
git checkout prNN ## After checking out you can compile, edit, do whatever to the PR branch | |
git checkout main ## If you're happy switch back to main branch before merging | |
git merge --no-ff prNN | |
git status | |
git log | |
git push origin main ## push to Github |
This file contains hidden or 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
# Test if R/Rstudio can run Stan with multiple cores or just hangs | |
t1dat = list(N=100, y = rnorm(100)) | |
default_Stan_normal = " | |
// The input data is a vector 'y' of length 'N'. | |
data { | |
int<lower=0> N; | |
vector[N] y; | |
} |
This file contains hidden or 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(RcppAlgos) | |
#' Calculate number of choices made by Shannon's bot | |
#' @description | |
#' Shannon's bot selects randomly answers to a multiple choice question the same | |
#' number of times as there is options to choose from. | |
#' It moves to the next question if at least 1 choice remains chosen after all | |
#' choices are made. | |
#' If not, i.e. nothing remains selected, the question is retried again, until | |
#' at least one choice remains. |