as_paragraph() assembles one or more chunks into a single paragraph
that defines the content of a flextable cell. Each cell in a flextable
contains exactly one paragraph; a paragraph is an ordered sequence of
chunks.
Chunks are the smallest content units and can be created with
as_chunk() (formatted text), as_b() / as_i() (bold / italic
shortcuts), minibar() (inline bar), as_image() (image),
gg_chunk() (ggplot), as_equation() (equation) or
hyperlink_text() (link). Plain character strings passed to
as_paragraph() are automatically converted to chunks via
as_chunk().
The resulting paragraph is passed to the value argument of
compose(), mk_par(), add_header_lines(),
add_footer_lines() or footnote() to set cell content.
Arguments
- ...
chunk elements that are defining the paragraph content. If a character is used, it is transformed to a chunk object with function
as_chunk().- list_values
a list of chunk elements that are defining the paragraph content. If specified argument
...is unused.
See also
as_chunk(), minibar(),
as_image(), hyperlink_text()
Other functions for mixed content paragraphs:
append_chunks(),
compose(),
prepend_chunks()
Examples
library(flextable)
ft <- flextable(airquality[sample.int(150, size = 10), ])
ft <- compose(ft,
j = "Wind",
value = as_paragraph(
as_chunk(Wind, props = fp_text_default(color = "orange")),
" ",
minibar(value = Wind, max = max(airquality$Wind), barcol = "orange", bg = "black", height = .15)
),
part = "body"
)
ft <- autofit(ft)
ft
Ozone
Solar.R
Wind
Temp
Month
Day
59
1.7 
76
6
22
266
14.9 
58
5
26
35
7.4 
85
8
5
168
238
3.4 
81
8
25
44
236
14.9 
81
9
11
47
10.3 
73
6
27
4
25
9.7 
61
5
23
80
294
8.6 
86
7
24
287
9.7 
74
6
2
46
237
6.9 
78
9
16
