2022-10-28 12:23:22 +02:00
|
|
|
% Generated by roxygen2: do not edit by hand
|
|
|
|
% Please edit documentation in R/source_lines.R
|
|
|
|
\name{source_lines}
|
|
|
|
\alias{source_lines}
|
2023-01-04 14:33:48 +01:00
|
|
|
\title{Source Lines from a File}
|
2022-10-28 12:23:22 +02:00
|
|
|
\usage{
|
|
|
|
source_lines(file, lines, ...)
|
|
|
|
}
|
|
|
|
\arguments{
|
2023-01-04 14:33:48 +01:00
|
|
|
\item{file}{A character string giving the path to the file to be sourced.}
|
2022-10-28 12:23:22 +02:00
|
|
|
|
2023-01-04 14:33:48 +01:00
|
|
|
\item{lines}{A numeric vector of line numbers to be sourced.}
|
2022-10-28 12:23:22 +02:00
|
|
|
|
2023-01-04 14:33:48 +01:00
|
|
|
\item{...}{Additional arguments to be passed to \code{\link{source}}.}
|
2022-10-28 12:23:22 +02:00
|
|
|
}
|
|
|
|
\value{
|
2023-01-04 14:33:48 +01:00
|
|
|
The result of \code{\link{source}}.
|
2022-10-28 12:23:22 +02:00
|
|
|
}
|
|
|
|
\description{
|
2023-01-04 14:33:48 +01:00
|
|
|
Sources specific lines from a file
|
|
|
|
}
|
|
|
|
\examples{
|
|
|
|
test_file <- tempfile(fileext = ".R")
|
|
|
|
writeLines(c("# Line 1", "2+2", "# Line 3"), test_file)
|
|
|
|
source_lines(test_file, 1:2, echo=TRUE)
|
|
|
|
|
|
|
|
}
|
2023-01-05 10:21:46 +01:00
|
|
|
\seealso{
|
|
|
|
This function is borrowed
|
|
|
|
from \href{https://gist.github.com/christophergandrud/1eb4e095974204b12af9}{christophergandrud}
|
|
|
|
}
|