Reputation: 27
I would like to perform a line-by-line review of code written using RStudio.
I have two questions:
Thanks!
** Update: Considering that I wasn't trying to write a report straight from the R/RStudio interface, I realized I could easily open and print the code using Notepad ++. So, here's to remembering a software that most folks probably use for their coding anyway.
Upvotes: 1
Views: 5095
Reputation: 11
I found the answer to a similar question that I had for writing a script to a text file here https://statisticsglobe.com/r-save-all-console-input-output-to-file and wanted to share for others facing the same dilemma. Unfortunately, this method does not write out the line numbers though.
# Writing currently opened R script to file
fout = "filpath/filename.txt"
cat(readChar(rstudioapi::getSourceEditorContext()$path, file.info(rstudioapi::getSourceEditorContext()$path)$size), file = fout)
Upvotes: 1