[R] how does one print code

Phil Spector spector at stat.berkeley.edu
Thu Apr 8 23:28:28 CEST 2010

David -
    You can do what you want pretty easily using sink.
Suppose you want the source code for function "blah"
in the file "blah.func":


 					- Phil Spector
 					 Statistical Computing Facility
 					 Department of Statistics
 					 UC Berkeley
 					 spector at stat.berkeley.edu

On Thu, 8 Apr 2010, David.Epstein wrote:

> There is quite a long piece of code defining a certain function in one of the
> R packages.
> I think the code has a bug and I want to get the code into a file so that I
> can take a proper look, and possibly fix it.
> how does one do this? (I mean getting the code into a file, not fixing the
> bug.) I suppose I could copy and paste, but that's a bit error prone for
> various reasons. I want the same arrangement of code formatting as in the
> original---copy and paste often messes this up.
> I tried using as.character(functionname) but that wasn't at all appreciated.
> I  tried searching the archives of this forum but couldn't figure out
> exactly what to search for (got too many hits). I also tried Google, but
> that was also no help.
> Thanks
> David
> -- 
> View this message in context: http://n4.nabble.com/how-does-one-print-code-tp1788686p1788686.html
> Sent from the R help mailing list archive at Nabble.com.
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list