Skip to content

Instantly share code, notes, and snippets.

View davidroberson's full-sized avatar
🏠
Working from home

Dave Roberson davidroberson

🏠
Working from home
View GitHub Profile
@christophergandrud
christophergandrud / source_lines.R
Created December 1, 2014 14:08
Source specific lines from a file in R
#' Source specific lines in an R file
#'
#' @param file character string with the path to the file to source.
#' @param lines numeric vector of lines to source in \code{file}.
source_lines <- function(file, lines){
source(textConnection(readLines(file)[lines]))
}