Description Usage Arguments Details Value References See Also Examples
Create an rtf (rich text format) document.
1 2 3 4 5 6 7 8 |
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.
This is a copy of the startrtf
function from the
[GLFC] package.
heading
, para
, tabl
,
figu
, endrtf
,
RTF
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ## 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 ", EchoEnv$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 ",
EchoEnv$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.