The Vim on the server is horribly outdated. Many of the things below won’t work, or will require extensive setup. In order to ease the pain, I suggest using the version installed and maintained by Micha via the [EBI-predoc config][config].
This file contains 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
parsetidy <- function(x, ...) UseMethod("parsetidy") | |
parsetidy.default <- function(x, ...) { | |
# if it's not a call or name (e.g. it's numeric), | |
# don't need it | |
data.frame() | |
} | |
This file contains 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
# Roll your own GitHub Gist Comments Feed in R | |
library(xml2) # github version | |
library(rvest) # github version | |
library(stringr) # for str_trim & str_replace | |
library(dplyr) # for data_frame & bind_rows | |
library(pbapply) # free progress bars for everyone! | |
library(XML) # to build the RSS feed | |
who <- "hrbrmstr" # CHANGE ME! |
This file contains 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
--- | |
author: "<a href=\"http://twitter.com/klmr\">@klmr</a>" | |
title: "Gun deaths and gun ownership in the USA" | |
date: 2015-06-19 | |
output: | |
html_document: | |
theme: readable | |
--- | |
```{r echo=FALSE} | |
library(dplyr, warn.conflicts = FALSE, quietly = TRUE) |
This file contains 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
# Hello, and welcome to makefile basics. | |
# | |
# You will learn why `make` is so great, and why, despite its "weird" syntax, | |
# it is actually a highly expressive, efficient, and powerful way to build | |
# programs. | |
# | |
# Once you're done here, go to | |
# http://www.gnu.org/software/make/manual/make.html | |
# to learn SOOOO much more. |
This file contains 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
#include "mach_gettime.h" | |
#include <mach/mach_time.h> | |
#define MT_NANO (+1.0E-9) | |
#define MT_GIGA UINT64_C(1000000000) | |
// TODO create a list of timers, | |
static double mt_timebase = 0.0; | |
static uint64_t mt_timestart = 0; |
This file contains 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
#!/bin/bash | |
# Wrapper script to run Vim-R-plugin R sessions as interactive jobs on LSF platforms. | |
# To use it, edit ~/.vimrc and add 'let vimrplugin_r_path = <path_to_script>' | |
# lets you deicde | |
echo What version of R do you want? | |
echo "1) R vX.X.X" | |
echo "2) R vZ.Z.Z" | |
echo "3) R vY.Y.Y" | |
read -t 60 -p '>' answer |
This file contains 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(stringr) | |
library(BatchJobs) | |
library(plyr) | |
# Rationale | |
# This script uses BatchJobs to run functions either locally, on multiple cores, or LSF, | |
# depending on your BatchJobs configuration. It has a simpler interface, does more error | |
# checking than the library itself, and is able to queue different function calls. The | |
# function supplied *MUST* be self-sufficient, i.e. load libraries and scripts. | |
# BatchJobs on the EBI cluster is already set up when using the gentoo prefix. |
This file contains 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
# encode | |
tr 'A-Za-z' 'N-ZA-Mn-za-m' <<<"The Quick Brown Fox Jumps Over The Lazy Dog" | |
# decode | |
echo "Gur Dhvpx Oebja Sbk Whzcf Bire Gur Ynml Qbt" | tr '[A-Za-z]' '[N-ZA-Mn-za-m]' |
This file contains 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
#' (Re-)source parts of a file | |
#' | |
#' \code{rs} loads, parses and executes parts of a file as if entered into the R | |
#' console directly (but without implicit echoing). | |
#' | |
#' @param filename character string of the filename to read from. If missing, | |
#' use the last-read filename. | |
#' @param from first line to parse. | |
#' @param to last line to parse. | |
#' @return the value of the last evaluated expression in the source file. |