-
-
Save rafalcode/a1796370a2ccf06b8167f2a27dcf00e7 to your computer and use it in GitHub Desktop.
Source specific lines from a file in R
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
#' 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])) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment