sdc_log: Create Stata-like log files from R Scripts

View source: R/sdc_log.R

sdc_logR Documentation

Create Stata-like log files from R Scripts


This function creates Stata-like log files from R Scripts. It can handle several files (in a character vector) at once.


sdc_log(r_script, destination, replace = FALSE, append = FALSE, local = FALSE)



character Path of the R script to be run with logging.


One of:

  • character Path of the log file to be used.

  • file connection to which the log should be written. This is especially useful, when you have nested calls to sdc_log() and want to write everything into the same log file. Then, create a single file connection and provide this connection to all calls to sdc_log() (and close it afterwards).


logical Indicates whether to replace an existing log file.


logical Indicates whether to append an existing log file.


One of:

  • logical Indicates whether to evaluate within the global environment (FALSE) or the calling environment (TRUE).

  • environment A specific evaluation environment. Determines the evaluation environment. Useful whenever sdc_log() is called from within a function, or for nested sdc_log() calls. By default (FALSE) evaluation occurs in the global environment. See also source.


character vector holding the path(s) of the written log file(s).

sdcLog documentation built on March 20, 2022, 1:06 a.m.