View source: R/add_as_heading.R
add_as_heading | R Documentation |
knitrContainer
add_as_heading()
converts obj
to character
,
formats it as a heading of a section and includes it in the
container
. Function print_objects
will print the object as text.
add_as_heading(container = NULL, obj, level = 1)
add_as_section(container = NULL, obj, level = 1)
add_as_subsection(container = NULL, obj)
add_as_heading1(container = NULL, obj)
add_as_heading2(container = NULL, obj)
add_as_heading3(container = NULL, obj)
add_as_heading4(container = NULL, obj)
add_as_heading5(container = NULL, obj)
add_as_heading6(container = NULL, obj)
container |
|
obj |
(string) a piece of text to be used as heading. |
level |
(integer) The level of heading (between 1 and 6). 1 is the top level section. |
All the remaining functions listed here are wrappers of
add_as_heading
with different value of parameter
level
passed to add_as_heading
:
In add_as_section()
default value of level = 1
.
In add_as_heading1()
default value of level = 1
.
In add_as_subsection()
default value of level = 2
.
In add_as_heading2()
default value of level = 2
.
In add_as_heading3()
default value of level = 3
.
In add_as_heading4()
default value of level = 4
.
In add_as_heading5()
default value of level = 5
.
In add_as_heading6()
default value of level = 6
.
Vilmantas Gegzna
Other knitrContainer
functions:
Join()
,
add_as_
,
as.knitrContainer()
,
knitrContainer-class
,
print_all()
,
print()
,
summary()
# Find more examples in link `knitrContainer-class`
# Initialize container
container <- knitrContainer()
# Fill the container
container %<>% add_as_heading1(obj = "Heading 1")
container %<>% add_as_heading2(obj = "Heading 2")
container %<>% add_as_heading3(obj = "Heading 3")
container %<>% add_as_heading4(obj = "Heading 4")
container %<>% add_as_heading5(obj = "Heading 5")
container %<>% add_as_heading6(obj = "Heading 6")
container %<>% add_as_heading(obj = "Heading 5", level = 5)
container %<>% add_as_heading(obj = "Heading 6", level = 6)
container %<>% add_as_section(obj = "Heading 1")
container %<>% add_as_subsection(obj = "Heading 2")
# Print the contents of the container
print_all(container)
# Operator `%<>%` updates the object `container`
?`%<>%`
# These 2 lines are equivalent:
container <- add_as_section(container, obj = "Heading 1")
container %<>% add_as_section(obj = "Heading 1")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.