sink
and history
with a
couple extra bells and whistles.txtStart(file, commands=TRUE, results=TRUE, append=FALSE, cmdfile,
visible.only=TRUE)
txtStop()
txtComment(txt,cmdtxt)
txtSkip(expr)
etxtStart(dir = tempfile("etxt"), file = "transcript.txt",
commands = TRUE, results = TRUE, append = FALSE,
cmdbg = "white", cmdcol = "red", resbg = "white",
rescol = "navy", combg = "cyan", comcol = "black",
cmdfile, visible.only = TRUE)
etxtStop()
etxtComment(txt, cmdtxt)
etxtSkip(expr)
etxtPlot(file=paste(tempfile('plot',R2txt.vars$dir),'.eps',sep=''),
width=4, height=4)
file
or replace itfile
file
file
file
file
file
source
d or copied and pasted fromfile
cmdfile
file
or cmdfile
dev.copy2eps
dev.copy2eps
etxtStop
returns the name of the transcript file (including the
directory path).
txtSkip
and etxtSkip
return the value of expr
.results
is TRUE and commands
is FALSE then the result
is similar to the results of sink
. If commands
is true as well then the results will show both the commands
and results similar to the output on the screen. If both
commands
and results
are FALSE then pretty much
the only thing these functions will accomplish is to waste some
computing time.
If cmdfile
is
specified then an additional file is created with the commands
used (similar to the history
command), this file can be
used with source
or copied and
pasted to the terminal.
The Start functions specify the file/directory to create and
start the transcript. The prompts are changed to remind you
that the commands/results are being copied to the transcript.
The Stop functions stop the recording and reset the prompts.
The R parser strips comments and does some reformating so the
transcript file may not match exactly with the terminal
output. Use the txtComment
or etxtComment
functions to add a comment. This will show up as a line offset
by whitespace in the transcript file and highlighted in the
etxt version. If cmdtxt
is specified then that line
will be inserted into cmdfile
preceeded by a # so it
will be skipped if sourced or copied.
The tktSkip
and etxtSkip
functions will run the
code in expr
but will not include the commands or
results in the transcript file (this can be used for side
computations, or requests for help, etc.).
The etxtPlot
function calls dev.copy2eps
to
create a copy of the current plot and iserts the proper command
into the transcript file so that the eps file will be included
in the final postscript file after processing.sink
, history
,
Sweave
, the odfWeave package, the R2HTML packageetxtStart()
etxtComment('This is todays transcript')
date()
x <- rnorm(25)
summary(x)
stem(x)
etxtSkip{?hist}
hist(x)
etxtPlot()
Sys.Date()
Sys.time()
my.file <- etxtStop()
# assumes enscript and ps2pdf are on your path
system(paste('enscript -e -B -p transcript.ps ', my.file) )
system('ps2pdf transcript.ps')
Run the code above in your browser using DataLab