Most operating systems have tools which allow you to audit the resources
used by a running process, for example the 'lsof' (list open files) command
on Unix and MacOS X.  Or, for more complex dynamic tracing, the DTrace
framework again on MacOS X or BSD Unix.

Not sure what the Windows equivalent would be, or what platform you are
using, but given the number of ways that code in packages and such may be
accessing files in C code possibly based on environment variables or other
configuration parameters, I would want to lean heavily on the operating
systems tools for things like this rather than rely on parsing your R code
looking for specific file access.

           - Murray



On Mon, Nov 4, 2013 at 1:32 PM, Martin Gregory <GregoryM@t-online.de> wrote:

> I'm using R in a regulated environment and one of the requirements is to
> be able to trace how a result is arrived at. I would like to be able to
> determine which files are opened in read or write mode by an R session, for
> example when a program uses source, sink, file, open, read.table,
> write.table or any of the other functions which can be used to read or
> write files. I'm also interested in output to graphics devices.
>
> I've looked in the documentation but only found information relating to
> profiling. Looking through the source code it seems that much file i/o is
> done via the C functions *_open in main/connections.c but don't see
> anything there that looks like logging.
>
> Could someone let me know if it is possible to log which files are opened?
>
> Regards,
> Martin Gregory
>
> ______________________________________________
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

	[[alternative HTML version deleted]]

