Created
May 3, 2015 15:37
-
-
Save brianspiering/b6bc22825b4984992277 to your computer and use it in GitHub Desktop.
Template for R programs
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
#! /usr/bin/env Rscript | |
# File description ------------------------------------------------------------- | |
# | |
# | |
# Setup packages --------------------------------------------------------------- | |
# List of packages for session | |
.packages = c("devtools", | |
"stringr", | |
"dplyr", | |
"ggplot2", | |
"knitr", | |
"markdown") | |
# Install CRAN packages (if not already installed) | |
.inst <- .packages %in% installed.packages() | |
if(length(.packages[!.inst]) > 0) install.packages(.packages[!.inst]) | |
# Load packages into session | |
lapply(.packages, require, character.only=TRUE) | |
cat("\014") # Clear console | |
# General setup ---------------------------------------------------------------- | |
rm(list=ls()) # Delete all existing variables | |
graphics.off() # Close all open plots | |
# Code Block ------------------------------------------------------------------- | |
# TODO: Add code | |
# Tidy things up --------------------------------------------------------------- | |
cat("\014") # Clear console | |
# Scratchpad ------------------------------------------------------------------- | |
# print( "Hello, world!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment