Skip to content

Instantly share code, notes, and snippets.

Richard Morey richarddmorey

Block or report user

Report or block richarddmorey

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@richarddmorey
richarddmorey / eurovision2019.csv
Last active May 19, 2019
Eurovision 2016-2018 analysis
View eurovision2019.csv
To.country Jury Televoting
Netherlands 231 261
Italy 212 253
Russia 125 244
Switzerland 148 212
Norway 47 291
Sweden 239 93
Azerbaijan 197 100
North Macedonia 237 58
Australia 154 131
@richarddmorey
richarddmorey / demo.R
Last active Apr 3, 2019
Demonstrate reading bibtex for Rmarkdown from the web (e.g., from github)
View demo.R
# This file is to demonstrate the output.
# It is not needed.
testRmd = "https://gist.githubusercontent.com/richarddmorey/c4dd7d1fba2aa055a6f71286baedac25/raw/c256dd9f1ca0b22dfbce12443e1cb98ed5bb9d86/demo.Rmd"
tf = tempfile(fileext = ".Rmd")
tf_out = tempfile(fileext = ".html")
cat(RCurl::getURL(testRmd), file = tf)
@richarddmorey
richarddmorey / install_flexjags.R
Last active Mar 19, 2019
Install flexjags in R for Essex Summer School 3F (Bayesian data analysis)
View install_flexjags.R
## First install the devtools package if necessary
devtools::install_github("richarddmorey/EssexSummerSchoolBayes", subdir = "shiny_demo/flexjags/flexjags")
flexjags::run_flexjags()
View power.R
M = 1000
N = round(sort(rpois(M, 10)^1.5, decreasing = TRUE)) + 20
pows = c(.5,.8,.95)
setup = expand.grid(N=N, pow = pows)
es = mapply(FUN = function(n, power, alpha) power.t.test(n = n, sig.level = alpha, power = power)$delta,
n = setup$N, power = setup$pow, MoreArgs = list(alpha = .05))
dim(es) = c(setup$es,length(N), length(pows))
@richarddmorey
richarddmorey / showtext.Rmd
Created Jan 16, 2018
Demonstration of how to use other fonts in an Rmarkdown document
View showtext.Rmd
---
output:
html_document:
dev: svg
fig_width: 5
fig_height: 4
---
<!-- The output of this file can be found at
http://rpubs.com/richarddmorey/fonts
@richarddmorey
richarddmorey / analysis.R
Last active Dec 27, 2017
data from 855 t tests (from Wetzels et al 2011)
View analysis.R
## Paper is here: http://www.ejwagenmakers.com/2011/WetzelsEtAl2011_855.pdf
## Load the three data files
one_sample = read.delim("https://gist.githubusercontent.com/richarddmorey/e44df8750d69b5c0cd8db9513e75fba4/raw/a476c41e23d944bcf1ac6d84860218900bec0fe1/data_onesample.txt")
two_sample = read.delim("https://gist.githubusercontent.com/richarddmorey/e44df8750d69b5c0cd8db9513e75fba4/raw/a476c41e23d944bcf1ac6d84860218900bec0fe1/data_twosample.txt")
paired_sample = read.delim("https://gist.githubusercontent.com/richarddmorey/e44df8750d69b5c0cd8db9513e75fba4/raw/a476c41e23d944bcf1ac6d84860218900bec0fe1/data_pairedsample.txt")
# Define N1 and N2 for one sample tests
# for convenience
colnames(one_sample)[1] = "N1"
View file52f07dae14c2.md
data(attitude)
o = lm(rating ~ complaints, data = attitude)
par(mfrow=c(1,2), bg="white")
plot(rating ~ complaints, data = attitude)
abline(o, col = "red")
plot(o, ask = FALSE)
View file4eae56528d28.md
x = rnorm(1000)
y = rnorm(1000)
plot(x,y,pch=19,col=rgb(0,0,1,.2))

plot of chunk unnamed-chunk-2

@richarddmorey
richarddmorey / index.Rmd
Last active Nov 29, 2017
example for shinyjs
View index.Rmd
---
runtime: shiny
---
```{r echo=FALSE, message=FALSE, warning=FALSE}
require(shinyjs)
useShinyjs(rmd=TRUE)
observe({
updateTextInput(session, 'ID', value = "Updated.")
View why_leave.R
## Richard D. Morey
## 3 Nov 2017
# Redirect plots to temp directory
# We just want the variables
wd = getwd()
setwd(tempdir())
source('https://osf.io/x73zq/download?version=1')
setwd(wd)
You can’t perform that action at this time.