insert | R Documentation |
Inserts a reference to the figure, mdtable, mdexpr, mdhtml, mdtext or mdlink object as an R code chunk into a R markdown file or prints it into the standard output and, concomitantly, copies into the clipboard.
insert(object, ...)
## S3 method for class 'figure'
insert(
object,
file = NULL,
html = FALSE,
style_ref = "legend",
append = TRUE,
relative_dim = FALSE,
...
)
## S3 method for class 'mdtable'
insert(
object,
file = NULL,
format = c("flextable", "kable"),
rownames = FALSE,
append = TRUE,
...
)
## S3 method for class 'mdexpr'
insert(
object,
file = NULL,
format = c("chunk", "inline"),
include = NULL,
echo = NULL,
warning = NULL,
message = NULL,
append = TRUE,
...
)
## S3 method for class 'mdtext'
insert(object, file = NULL, append = TRUE, ...)
## S3 method for class 'mdlink'
insert(
object,
title = object$ref_name,
html = FALSE,
file = NULL,
append = TRUE,
...
)
## S3 method for class 'mdhtml'
insert(object, file = NULL, append = TRUE, ...)
object |
an object to be referenced. |
... |
extra arguments, currently none. |
file |
a file to which the chunks are written. If the file exists already, it will be appended or overwritten. If NULL, the text is printed in the console and copied into the clipboard. |
html |
logical: should the figure legend or link be HTML styled? |
style_ref |
name of the CSS style of the legend text, valid only for the HTML output. |
append |
logical, should the output file be appended? |
relative_dim |
logical, should the figure dimensions be inserted as a call to an unit-converting function? If FALSE, fixed numeric dimensions are inserted into the code chunk. |
format |
which format the table should be inserted in? 'flextable' (default) or 'kable' available currently. |
rownames |
logical, should the table rownames be included in the markdown output? If TRUE, they are displayed in the first, unnamed column. Relevant only for format = 'flextable'. |
include |
the include option of the chunk, skipped if NULL. |
echo |
echo chunk option, skipped if NULL. |
warning |
warning chunk option, skipped if NULL. |
message |
message chunk option, skipped if NULL. |
title |
a string to be used as a link title, defaults to the 'ref_name' of the mdlink object. |
Only for the figure
, mdtable
class instances with
defined 'ref_name' and 'caption' parameters.
To enable the clipboard access, you may need to set the CLIPR_ALLOW
environment variable to TRUE, as described for
write_clip
.
For include, echo, message and warning chunk options, see:
https://rmarkdown.rstudio.com/lesson-3.html
returns invisibly the requested R code chunk.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.