## Keep parse data in non interactive sessions.
if (!interactive())
op <- options(keep.source = TRUE)
## Correct use of spacing around a comma
fil <- tempfile(fileext = ".R")
cat("x <- c(2, 3, 5)", "crossprod(2,", "x)",
"a <- array(1:24, 2:4)", "a[1, , ]",
file = fil, sep = "\n")
commas_style(getSourceData(fil))
## Incorrect use of spacing around a comma
fil <- tempfile(fileext = ".R")
cat("x <- c(2,3, 5)", "crossprod(2 ,", "x)",
"a <- array(1:24, 2:4)", "a[1,, ]",
file = fil, sep = "\n")
commas_style(getSourceData(fil))
Run the code above in your browser using DataLab