startrtf | R Documentation |
Create an rtf (rich text format) document.
startrtf( file = NULL, dir = getwd(), width = 8.5, height = 11, omi = c(1, 1, 1, 1), quiet = FALSE )
file |
Character scalar name of document, default "RGeneratedDocument" with
|
dir |
Character scalar name of directory where document should be stored,
default |
width |
Numeric scalar width of document page in inches, default 8.5. |
height |
Numeric scalar height of document page in inches, default 11. |
omi |
Numeric vector, length 4, width of document page margins in inches (bottom, left, top, right), default c(1, 1, 1, 1). |
quiet |
Logical scalar indicating if name of new rtf document should be printed to command line, default FALSE. |
The rtf file may be written to until the endrtf()
function
is run.
If you assign your rtf file to an object called doc
,
you can use the default settings in other GLFC
rtf functions.
An rtf file is created in the specified directory.
An object of class rtf is created. This object is referred to in
other functions to write to the file.
In addition, two numeric vectors of length 1, tabcount
and
figcount
, are written to the working directory to keep track
of the number of tables and figures written to the rtf document, and
label the captions accordingly.
heading
, para
, tabl
,
figu
, figbig
, endrtf
,
RTF
.
## Not run: # open a Word-friendly rtf file today <- Sys.Date() doc <- startrtf(file=paste("Example", today)) # add headings heading("Title") heading(paste("Author", today, sep=" - "), 2) # add a paragraph para("This is how write a paragraph.") # reference a table para("This is how you reference a table (Table ", GLFCenv$tabcount, ").") # add the table tab <- matrix(sample(20), ncol=5, dimnames=list(paste("Row", 1:4), paste("Column", 1:5))) tabl("A silly table.") # reference a figure para("And this is how you reference a figure (Figure ", GLFCenv$figcount, ").") # add the figure fig <- function() { par(mar=c(4, 4, 1, 1)) plot(1:10, 1:10, xlab="X", ylab="Y") } figu("A silly plot.", h=4, w=4) # save the rtf file endrtf() ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.