Skip to content

Instantly share code, notes, and snippets.

View noamross's full-sized avatar

Noam Ross noamross

View GitHub Profile
@noamross
noamross / keystrokes.R
Created March 21, 2016 16:08 — forked from ottlngr/keystrokes.R
Visualizing keystrokes using ggplot2
##### Visualizing keystrokes using ggplot2 #####
library(ggplot2)
# a character string to visualize:
string <- 'R is an integrated suite of software facilities for data manipulation, calculation and graphical display.'
# a data.frame representing the keys of a qwerty keyboard
qwerty <- data.frame(
id = 1:47,
@noamross
noamross / source_rmd.R
Last active December 13, 2023 18:52
Source an RMD file
#' Source the R code from an knitr file, optionally skipping plots
#'
#' @param file the knitr file to source
#' @param skip_plots whether to make plots. If TRUE (default) sets a null graphics device
#'
#' @return This function is called for its side effects
#' @export
source_rmd = function(file, skip_plots = TRUE) {
temp = tempfile(fileext=".R")
knitr::purl(file, output=temp)
@noamross
noamross / BlockHole-tweetdeck.css
Last active January 7, 2016 23:12 — forked from mcnees/BlockHole.css
Change "Block" to "Drop Into Black Hole" in a Twitter account's dropdown action menu.
/* Install the Stylish extension for your browser, add this code
as a new Style, and apply it to the domain 'tweetdeck.twitter.com' */
/* You can get Stylish here: */
/* Safari - http://sobolev.us/stylish/ */
/* Chrome - https://chrome.google.com/webstore/detail/stylish/fjnbnpbmkenffdnngjfgmeleoegfcffe */
/* Tweet improvements, comments, or corrections to @mcnees. */
/* ------------------------------------------------------------- */
@noamross
noamross / gist:b902d1cda9bedb1bd060
Last active August 29, 2015 14:24
Capturing all console output, including messages from C programs, etc
conn <- textConnection("printed_output", "w", local = TRUE)
sink(conn, type=c("output"))
sink(conn, type=c("message"))
install.packages("ggplot2")
sink(NULL)
printed_output
# This will append the text to the printed_output variable, so clear it beforehand.
@noamross
noamross / disease_tweeps.R
Last active August 29, 2015 14:23
I wanted to make a list of my disease ecology followers and followees on twitter, so...
library(twitteR)
library(rlist)
library(pipeR)
library(stringi)
# Authenticate with twitter
# consumer/access keys and secrets for the twitter API must be defined elsewhere
setup_twitter_oauth(consumer_key, consumer_secret, access_token, access_secret)
# Get all my followers and followees
@noamross
noamross / test.R
Created June 22, 2015 20:14
test for import::from
myfunc <- function(x) {
x + 1
}
@noamross
noamross / SEM example.R
Created May 20, 2015 18:16
A first look at structured equation models using the Lavaan package
# A FIRST LOOK AT LAVAAN
## By Grace Charles, presented at Davis R Users' Group on May 15, 2015
## adapted from Jim Grace's SEM workshop and Lavaan tutorials
# Set your working directory
setwd("~/Desktop/DAVIS/sem workshop")
###Load Libraries
library(lavaan)
@noamross
noamross / base_r_plotting_tutorial_koontz_d-rug.r
Created April 24, 2015 17:34
Back to basics: High quality plots using base R graphics
### Title: Back to basics: High quality plots using base R graphics
### An interactive tutorial for the Davis R Users Group meeting on April 24, 2015
###
### Date created: 20150418
### Last updated: 20150423
###
### Author: Michael Koontz
### Email: [email protected]
### Twitter: @michaeljkoontz
###
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.