File: footnote.Rd

package info (click to toggle)
r-cran-flextable 0.8.4-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,264 kB
  • sloc: sh: 15; makefile: 2
file content (92 lines) | stat: -rw-r--r-- 2,523 bytes parent folder | download
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/footnote.R
\name{footnote}
\alias{footnote}
\title{add footnotes to flextable}
\usage{
footnote(
  x,
  i = NULL,
  j = NULL,
  value,
  ref_symbols = NULL,
  part = "body",
  inline = FALSE,
  sep = "; "
)
}
\arguments{
\item{x}{a flextable object}

\item{i, j}{cellwise rows and columns selection}

\item{value}{a call to function \code{\link[=as_paragraph]{as_paragraph()}}.}

\item{ref_symbols}{character value, symbols to append that will be used
as references to notes.}

\item{part}{partname of the table (one of 'body', 'header', 'footer')}

\item{inline}{whether to add footnote on same line as previous footnote or not}

\item{sep}{used only when inline = TRUE, character string to use as
a separator between footnotes.}
}
\description{
The function let add footnotes to a flextable object
by adding some symbols in the flextable and associated notes in
the footer of the flextable.

Symbols are added to the cells designated by the selection \code{i}
and \code{j}. If you use i = c(1,3) and j = c(2,5), then you will
add the symbols (or the repeated symbol) to cells \verb{[1,2]}
and \verb{[3,5]}.
}
\section{Illustrations}{


\if{html}{\figure{fig_footnote_1.png}{options: width="400"}}

\if{html}{\figure{fig_footnote_2.png}{options: width="400"}}
}

\examples{
ft_1 <- flextable(head(iris))
ft_1 <- footnote( ft_1, i = 1, j = 1:3,
            value = as_paragraph(
              c("This is footnote one",
                "This is footnote two",
                "This is footnote three")
            ),
            ref_symbols = c("a", "b", "c"),
            part = "header")
ft_1 <- valign(ft_1, valign = "bottom", part = "header")
ft_1 <- autofit(ft_1)

ft_2 <- flextable(head(iris))
ft_2 <- autofit(ft_2)
ft_2 <- footnote( ft_2, i = 1, j = 1:2,
               value = as_paragraph(
                c("This is footnote one",
                   "This is footnote two")
               ),
               ref_symbols = c("a", "b"),
               part = "header", inline = TRUE)
ft_2 <- footnote( ft_2, i = 1, j = 3:4,
               value = as_paragraph(
                 c("This is footnote three",
                   "This is footnote four")
               ),
               ref_symbols = c("c","d"),
               part = "header", inline = TRUE)
ft_2

ft_3 <- flextable(head(iris))
ft_3 <- autofit(ft_3)
ft_3 <- footnote(
  x = ft_3, i = 1:3, j = 1:3,
  ref_symbols = "a",
  value = as_paragraph("This is footnote one")
)
ft_3
}