Skip to content

Instantly share code, notes, and snippets.

View nickhepler's full-sized avatar

Nick Hepler nickhepler

View GitHub Profile
@nickhepler
nickhepler / keybase.md
Last active March 18, 2016 02:05
Keybase proof

Keybase proof

I hereby claim:

  • I am nickhepler on github.
  • I am nickhepler (https://keybase.io/nickhepler) on keybase.
  • I have a public key ASBO24DCZMbhQkDgWvN8yirfnHeMHYS31XAjBUunKHEtHQo

To claim this, I am signing this object:

@nickhepler
nickhepler / file_header.R
Last active August 8, 2016 22:56
R Source File Header GPL License
# <one line to give the program's name and a brief idea of what it does.>
# Copyright (C) <year> <name of author>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@nickhepler
nickhepler / example_function.R
Created June 10, 2015 02:42
R Example Function from Google's R Style Guide
CalculateSampleCovariance <- function(x, y, verbose = TRUE) {
# Computes the sample covariance between two vectors.
#
# Args:
# x: One of two vectors whose sample covariance is to be calculated.
# y: The other vector. x and y must have the same length, greater than one,
# with no missing values.
# verbose: If TRUE, prints sample covariance; if not, not. Default is TRUE.
#
# Returns:
@nickhepler
nickhepler / colour_scheme.md
Last active August 29, 2015 14:22
R Colour Schemes
@nickhepler
nickhepler / template.tex
Created June 19, 2015 18:50
Statistical Report Template by Hadley Wickham
% <one line to give the program's name and a brief idea of what it does.>
%
% Copyright (C) <year> <name of author>
%
% Version <x.y.z>
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.

base

Data Structure

str(x)  # Compactly display the internal structure of an R object.
class(x)  # Return the object class.
dim(x)  # Retrieve or set the dimension of an object.
nrow(x)  # Return the number of rows (observations).
ncol(x)  # Return the number of columns (variables).
object.size(x)  # Provides an estimate memory used to store an R object.
names(x)  # Get or set the names of an object.

head(x) # Returns the first part of a vector, matrix, table, data frame or function.

@nickhepler
nickhepler / R Package Installer Script
Last active August 24, 2016 23:30
install_packages.R
pkgs <- c(
"dplyr", "gapminder", "ggplot2", "jsonlite", "Lahman",
"lubridate", "modelr", "nycflights13", "purrr", "readr",
"stringr", "tibble", "tidyr"
)
install.packages(pkgs)
@nickhepler
nickhepler / ggplot_template.R
Created August 25, 2016 00:16
R Graphing Template
ggplot(data = <DATA>) +
<GEOM_FUNCTION>(mapping = aes(<MAPPINGS>))
---
title: "Codebook template"
author: "Your name here"
date: "The date here"
output:
html_document:
keep_md: yes
---
## Project Description
@nickhepler
nickhepler / RProjectOutline.md
Created March 8, 2017 14:24
R Project Process / File Structure

R Project Process / File Structure

  1. Import
  2. Tidy
  3. Tranform
  4. Visualize
  5. Model