Created
March 17, 2019 15:27
-
-
Save brianspiering/cc66a3e7381c80a687d7abf039417a22 to your computer and use it in GitHub Desktop.
Template for R files
This file contains hidden or 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("\f") # 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("\f") # Clear console | |
# Scratchpad ------------------------------------------------------------------- | |
# print( "Hello, world!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment