Skip to content

Instantly share code, notes, and snippets.

View tbates's full-sized avatar
🙈

Tim Bates tbates

🙈
View GitHub Profile
@wch
wch / lmgadget.R
Created January 20, 2016 18:17
Shiny Gadget example: lmGadget
library(shiny)
# Example usage:
# lmGadget(mtcars, "wt", "mpg")
#
# Returns a list with two items:
# $data: Data with excluded rows removed.
# $model: lm (model) object.
lmGadget <- function(data, xvar, yvar) {
library(miniUI)
@tbates
tbates / The Difference Pool.md
Last active August 29, 2015 14:10
Thoughts about a subject pool at Edinburgh

The Difference Pool

  1. Subjects: Population sample
  • N must be over 500, preferably 2,000
  • Ideally genetically informative
  1. Recruitment
  • Students
  • Public advertisements
  1. Content: There will be a set of basic features that will be tested at the outset
  • Need to compromise on this. Perhaps 2-hours of testing in the first instance?
# rm(list = ls()) # clear objects
# graphics.off() # close graphics windows
plot.new() # call new plot window
x = seq(-5,5, length=250)
y = dnorm(x)
plot(x,y, las=1, ylab='dnorm', type='n', yaxs='i', ylim=c(0, 0.5))
x2 = seq(qnorm(0.95), 5, length=50)
y2 = dnorm(x2)
polygon(c(x2[1], x2, x2[length(x2)]), c(0, y2, 0), border=NA, col='grey')
lines(x, y)
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active July 20, 2024 05:10
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@jeromyanglim
jeromyanglim / example-r-markdown.rmd
Created May 17, 2012 04:23
Example of using R Markdown
This post examines the features of [R Markdown](http://www.rstudio.org/docs/authoring/using_markdown)
using [knitr](http://yihui.name/knitr/) in Rstudio 0.96.
This combination of tools provides an exciting improvement in usability for
[reproducible analysis](http://stats.stackexchange.com/a/15006/183).
Specifically, this post
(1) discusses getting started with R Markdown and `knitr` in Rstudio 0.96;
(2) provides a basic example of producing console output and plots using R Markdown;
(3) highlights several code chunk options such as caching and controlling how input and output is displayed;
(4) demonstrates use of standard Markdown notation as well as the extended features of formulas and tables; and
(5) discusses the implications of R Markdown.