RcodeBlock | R Documentation |
RcodeBlock
Specialized ContentBlock
designed to embed R
code in reports.
teal.reporter::ContentBlock
-> RcodeBlock
new()
Initialize a RcodeBlock
object.
RcodeBlock$new(content = character(0), ...)
content
(character(1)
or character(0)
) a string assigned to this RcodeBlock
...
any rmarkdown
R
chunk parameter and it value.
Returns a RcodeBlock
object with no content and no parameters.
Object of class RcodeBlock
, invisibly.
RcodeBlock <- getFromNamespace("RcodeBlock", "teal.reporter") block <- RcodeBlock$new()
set_content()
Sets content of this RcodeBlock
.
RcodeBlock$set_content(content)
content
(any
) R object
self
, invisibly.
RcodeBlock <- getFromNamespace("RcodeBlock", "teal.reporter") block <- RcodeBlock$new() block$set_content("a <- 1")
set_params()
Sets the parameters of this RcodeBlock
.
RcodeBlock$set_params(params)
params
(list
) any rmarkdown
R chunk parameter and its value.
Configures rmarkdown
chunk parameters for the R
code block,
influencing its rendering and execution behavior.
self
, invisibly.
RcodeBlock <- getFromNamespace("RcodeBlock", "teal.reporter") block <- RcodeBlock$new() block$set_params(list(echo = TRUE))
get_params()
Get the parameters of this RcodeBlock
.
RcodeBlock$get_params()
character
the parameters of this RcodeBlock
.
RcodeBlock <- getFromNamespace("RcodeBlock", "teal.reporter") block <- RcodeBlock$new() block$get_params()
get_available_params()
Get available array of parameters available to this RcodeBlock
.
RcodeBlock$get_available_params()
A character
array of parameters.
RcodeBlock <- getFromNamespace("RcodeBlock", "teal.reporter") block <- RcodeBlock$new() block$get_available_params()
from_list()
Create the RcodeBlock
from a list.
RcodeBlock$from_list(x)
x
(named list
) with two fields text
and params
.
Use the get_available_params
method to get all possible parameters.
self
, invisibly.
RcodeBlock <- getFromNamespace("RcodeBlock", "teal.reporter") block <- RcodeBlock$new() block$from_list(list(text = "sth", params = list()))
to_list()
Convert the RcodeBlock
to a list.
RcodeBlock$to_list()
named list
with a text and params
.
RcodeBlock <- getFromNamespace("RcodeBlock", "teal.reporter") block <- RcodeBlock$new() block$to_list()
clone()
The objects of this class are cloneable with this method.
RcodeBlock$clone(deep = FALSE)
deep
Whether to make a deep clone.
## ------------------------------------------------
## Method `RcodeBlock$new`
## ------------------------------------------------
RcodeBlock <- getFromNamespace("RcodeBlock", "teal.reporter")
block <- RcodeBlock$new()
## ------------------------------------------------
## Method `RcodeBlock$set_content`
## ------------------------------------------------
RcodeBlock <- getFromNamespace("RcodeBlock", "teal.reporter")
block <- RcodeBlock$new()
block$set_content("a <- 1")
## ------------------------------------------------
## Method `RcodeBlock$set_params`
## ------------------------------------------------
RcodeBlock <- getFromNamespace("RcodeBlock", "teal.reporter")
block <- RcodeBlock$new()
block$set_params(list(echo = TRUE))
## ------------------------------------------------
## Method `RcodeBlock$get_params`
## ------------------------------------------------
RcodeBlock <- getFromNamespace("RcodeBlock", "teal.reporter")
block <- RcodeBlock$new()
block$get_params()
## ------------------------------------------------
## Method `RcodeBlock$get_available_params`
## ------------------------------------------------
RcodeBlock <- getFromNamespace("RcodeBlock", "teal.reporter")
block <- RcodeBlock$new()
block$get_available_params()
## ------------------------------------------------
## Method `RcodeBlock$from_list`
## ------------------------------------------------
RcodeBlock <- getFromNamespace("RcodeBlock", "teal.reporter")
block <- RcodeBlock$new()
block$from_list(list(text = "sth", params = list()))
## ------------------------------------------------
## Method `RcodeBlock$to_list`
## ------------------------------------------------
RcodeBlock <- getFromNamespace("RcodeBlock", "teal.reporter")
block <- RcodeBlock$new()
block$to_list()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.