You may need to install the following libraries (if you don't already have them)
install.packages("RODBC")
install.packages("dplyr")
Load these packages
# ~/.tmuxinator/eesectors.yml | |
name: eesectors | |
root: ~/Remote_documents/eesectors/ | |
# Optional tmux socket | |
# socket_name: foo | |
# Runs before everything. Use it to start daemons etc. | |
# pre: sudo /etc/rc.d/mysqld start |
# Set prefix to capslock | |
set -g prefix C-b | |
# Set defaults | |
set -s escape-time 1 | |
set -g base-index 1 | |
setw -g pane-base-index 1 |
# If you come from bash you might have to change your $PATH. | |
# export PATH=$HOME/bin:/usr/local/bin:$PATH | |
# Path to your oh-my-zsh installation. | |
export ZSH=/Users/matthewupson/.oh-my-zsh | |
# Set name of the theme to load. Optionally, if you set this to "random" | |
# it'll load a random theme each time that oh-my-zsh is loaded. | |
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes | |
ZSH_THEME="robbyrussell" |
#export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ " | |
# Shorten and colour command prompt | |
if [ "$color_prompt" = yes ]; then | |
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u\[\033[00m\]:\[\033[01;34m\]\W\[\033[00m\]\$ ' | |
else | |
PS1='${debian_chroot:+($debian_chroot)}\u:\W\$ ' | |
fi |
#export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ " | |
# Shorten and colour command prompt | |
if [ "$color_prompt" = yes ]; then | |
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u\[\033[00m\]:\[\033[01;34m\]\W\[\033[00m\]\$ ' | |
else | |
PS1='${debian_chroot:+($debian_chroot)}\u:\W\$ ' | |
fi |
library(plyr) | |
library(dplyr) | |
# Create a vector of numbers | |
num_vec <- round(runif(n = 100, min = 1, max = 26)) | |
# Convert these to letters using the inbuilt letters vector | |
letter_vec <- letters[num_vec] |
# Have a look at rle in the console. This function is largely bastardised from | |
# it. I have used a testing framework testthat to ensure that the outcome is | |
# what we expect it to be. You can add more tests as required! | |
# Define the max_rl function ---- | |
max_rl <- function(x, val) { | |
# x is the target vector, val is the value for which we want to know the longest | |
# run length. |
#!/bin/bash | |
cat urls-august.csv | tr "\r" "\n" > urls-august-unix.csv | |
mv urls-august-unix.csv urls-august.csv |
library(mnormt) | |
mycols <- topo.colors(100,0.5) | |
xhat <- c(0.2, -0.2) | |
Sigma <- matrix(c(0.4, 0.3, | |
0.3, 0.45), ncol=2) | |
x1 <- seq(-2, 4,length=151) | |
x2 <- seq(-4, 2,length=151) | |
f <- function(x1,x2, mean=xhat, varcov=Sigma) | |
dmnorm(cbind(x1,x2), mean,varcov) | |
z <- outer(x1,x2, f) |