## Keep parse data in non interactive sessions.
if (!interactive())
op <- options(keep.source = TRUE)
## Valid line length
fil <- tempfile(fileext = ".R")
cat("## innocuous comment",
"x <- 2",
"y <- 3",
"x + y",
file = fil, sep = "\n")
line_length_style(getSourceData(fil))
## Limit valid line length to only 20 characters
fil <- tempfile(fileext = ".R")
cat("## no longer innocuous comment",
"x <- 2",
"y <- 3",
"x + y",
file = fil, sep = "\n")
line_length_style(getSourceData(fil), 20)
Run the code above in your browser using DataLab