Google R style guide suggests line length of maximum 80 characters. I was wondering how do I set the line length in R
. In stata
this is done as:
set linesize 80
Google R style guide suggests line length of maximum 80 characters. I was wondering how do I set the line length in R
. In stata
this is done as:
set linesize 80
Is:
options()$width
what you want?
You can set it like:
options(width=80)
If you are using R inside RStudio and/or within an rmarkdown
(.Rmd
) document, you can temporarily set the line length to format possible text output files.
An example:
ops <- options()
options(width=80) # Ensure that the printout formatting remains constant
writeLines(capture.output(sessionInfo()),
file.path("your/folders/sessInfo.txt"))
options(ops); rm(ops)
When working within RStudio, the console line length is adjusted dynamically, and thus must be set within a chunk to affect the output.
© 2022 - 2024 — McMap. All rights reserved.