Skip to content

Commit fbc4542

Browse files
committed
doc: review function families
1 parent e1c6a30 commit fbc4542

File tree

148 files changed

+473
-291
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+473
-291
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Type: Package
22
Package: flextable
33
Title: Functions for Tabular Reporting
4-
Version: 0.9.12.004
4+
Version: 0.9.12.005
55
Authors@R: c(
66
person("David", "Gohel", , "david.gohel@ardata.fr", role = c("aut", "cre")),
77
person("ArData", role = "cph"),

R/00-deprecated.R

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#' @keywords internal
2+
#' @title flextable old functions
3+
#' @description The function is maintained for compatibility with old codes
4+
#' mades by users but be aware it produces the same exact object than [flextable()].
5+
#' This function should be deprecated then removed in the next versions.
6+
#' @param data dataset
7+
#' @param col_keys columns names/keys to display. If some column names are not in
8+
#' the dataset, they will be added as blank columns by default.
9+
#' @param cwidth,cheight initial width and height to use for cell sizes in inches.
10+
#' @export
11+
regulartable <- function(data, col_keys = names(data), cwidth = .75, cheight = .25) {
12+
.Deprecated(new = "flextable")
13+
flextable(data = data, col_keys = col_keys, cwidth = cwidth, cheight = cheight)
14+
}

R/05_content.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -871,6 +871,7 @@ as_qmd <- function(x, display = x) {
871871
#' @return The path to the installed extension (invisibly).
872872
#' @seealso [as_qmd()] for creating Quarto markdown chunks,
873873
#' [knit_print.flextable()] for rendering options in knitr documents.
874+
#' @family flextable_configuration
874875
#' @examples
875876
#' \dontrun{
876877
#' use_flextable_qmd()
@@ -923,7 +924,7 @@ use_flextable_qmd <- function(path = ".", quiet = FALSE) {
923924
#' function [as_chunk()].
924925
#' @param list_values a list of chunk elements that are defining
925926
#' the paragraph content. If specified argument `...` is unused.
926-
#' @family functions for mixed content paragraphs
927+
#' @family cell_content_composition
927928
#' @seealso [as_chunk()], [minibar()],
928929
#' [as_image()], [hyperlink_text()]
929930
#' @examples

R/append_chunk.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#' @param ... chunks to be appened, see [as_chunk()], [gg_chunk()] and other
77
#' chunk elements for paragraph.
88
#' @seealso [as_chunk()], [as_sup()], [as_sub()], [colorize()]
9-
#' @family functions for mixed content paragraphs
9+
#' @family cell_content_composition
1010
#' @examples
1111
#' library(flextable)
1212
#' img.file <- file.path(R.home("doc"), "html", "logo.jpg")
@@ -60,7 +60,7 @@ append_chunks <- function(x, ..., i = NULL, j = NULL, part = "body") {
6060
#' @inheritParams args_selectors_without_all
6161
#' @param ... chunks to be prepended, see [as_chunk()], [gg_chunk()] and other
6262
#' chunk elements for paragraph.
63-
#' @family functions for mixed content paragraphs
63+
#' @family cell_content_composition
6464
#' @examples
6565
#' x <- flextable(head(iris))
6666
#' x <- prepend_chunks(

R/as_flextable.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#' @param x object to be transformed as flextable
88
#' @param ... arguments for custom methods
99
#' @export
10-
#' @family as_flextable methods
10+
#' @family flextable_constructors
1111
as_flextable <- function(x, ...) {
1212
UseMethod("as_flextable")
1313
}
@@ -881,6 +881,7 @@ as_flextable.pam <- function(x, digits = 4, ...) {
881881
#' flextable::use_model_printer()
882882
#' ```
883883
#' @seealso [use_df_printer()], [flextable()]
884+
#' @family flextable_configuration
884885
use_model_printer <- function() {
885886
fun <- function(x, ...) knitr::knit_print(as_flextable(x))
886887
registerS3method("knit_print", "lm", fun)

R/augment_rows.R

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
#' )
4141
#' ft
4242
#' @export
43-
#' @family functions for row and column operations in a flextable
43+
#' @family table_structure
4444
set_header_labels <- function(x, ..., values = NULL) {
4545
if (!inherits(x, "flextable")) {
4646
stop(sprintf("Function `%s` supports only flextable objects.", "set_header_labels()"))
@@ -105,7 +105,7 @@ set_header_labels <- function(x, ..., values = NULL) {
105105
#' the flextable, i.e. an header, footer or the body.
106106
#'
107107
#' @inheritParams args_x_part_no_all
108-
#' @family functions for row and column operations in a flextable
108+
#' @family table_structure
109109
#' @examples
110110
#' ft <- flextable(head(iris))
111111
#' ft <- delete_part(x = ft, part = "header")
@@ -156,7 +156,7 @@ delete_rows_from_part <- function(x, i) {
156156

157157
#' @export
158158
#' @title Delete flextable rows
159-
#'
159+
#' @family table_structure
160160
#' @description The function removes one or more rows
161161
#' from a 'flextable'.
162162
#' @details
@@ -235,7 +235,7 @@ delete_colums_from_part <- function(x, j) {
235235
#' They will have to be redone after this operation or
236236
#' performed only after this deletion.
237237
#' @inheritParams args_x_j
238-
#' @family functions for row and column operations in a flextable
238+
#' @family table_structure
239239
#' @examples
240240
#' ft <- flextable(head(iris))
241241
#' ft <- delete_columns(ft, j = "Species")
@@ -355,7 +355,7 @@ add_rows_to_tabpart <- function(x, rows, first = FALSE) {
355355
#'
356356
#' ft <- theme_booktabs(ft)
357357
#' ft
358-
#' @family functions for row and column operations in a flextable
358+
#' @family table_structure
359359
#' @seealso [flextable()]
360360
add_body <- function(x, top = TRUE, ..., values = NULL) {
361361
if (!inherits(x, "flextable")) {
@@ -410,7 +410,7 @@ add_body <- function(x, top = TRUE, ..., values = NULL) {
410410
#' ft_1 <- theme_booktabs(ft_1, bold_header = TRUE)
411411
#' ft_1 <- align(ft_1, align = "center", part = "all")
412412
#' ft_1
413-
#' @family functions for row and column operations in a flextable
413+
#' @family table_structure
414414
add_header <- function(x, top = TRUE, ..., values = NULL) {
415415
if (!inherits(x, "flextable")) {
416416
stop(sprintf("Function `%s` supports only flextable objects.", "add_header()"))
@@ -452,7 +452,7 @@ add_header <- function(x, top = TRUE, ..., values = NULL) {
452452
#' )
453453
#' ft <- align(ft, part = "footer", align = "right", j = 1:4)
454454
#' ft
455-
#' @family functions for row and column operations in a flextable
455+
#' @family table_structure
456456
add_footer <- function(x, top = TRUE, ..., values = NULL) {
457457
if (!inherits(x, "flextable")) {
458458
stop(sprintf("Function `%s` supports only flextable objects.", "add_footer()"))
@@ -538,7 +538,7 @@ add_footer <- function(x, top = TRUE, ..., values = NULL) {
538538
#' )
539539
#' ft_2 <- theme_box(ft_2)
540540
#' ft_2
541-
#' @family functions for row and column operations in a flextable
541+
#' @family table_structure
542542
#' @seealso [flextable()], [set_caption()]
543543
add_body_row <- function(x, top = TRUE, values = list(), colwidths = integer(0)) {
544544
if (!inherits(x, "flextable")) {
@@ -650,7 +650,7 @@ add_body_row <- function(x, top = TRUE, values = list(), colwidths = integer(0))
650650
#' )
651651
#' ft_2 <- theme_box(ft_2)
652652
#' ft_2
653-
#' @family functions for row and column operations in a flextable
653+
#' @family table_structure
654654
#' @seealso [flextable()], [set_caption()]
655655
add_header_row <- function(x, top = TRUE, values = character(0), colwidths = integer(0)) {
656656
if (!inherits(x, "flextable")) {
@@ -722,7 +722,7 @@ add_header_row <- function(x, top = TRUE, values = character(0), colwidths = int
722722
#'
723723
#' Labels can be formatted with [as_paragraph()].
724724
#' @inheritParams add_body_row
725-
#' @family functions for row and column operations in a flextable
725+
#' @family table_structure
726726
#' @seealso [flextable()], [set_caption()]
727727
#' @examples
728728
#' library(flextable)
@@ -834,7 +834,7 @@ data_from_char <- function(values, colwidths, col_keys) {
834834
#' be added as a new row.
835835
#' @param top should the row be inserted at the top
836836
#' or the bottom. Default to TRUE.
837-
#' @family functions for row and column operations in a flextable
837+
#' @family table_structure
838838
#' @examples
839839
#' # ex 1----
840840
#' ft_1 <- flextable(head(iris))
@@ -895,7 +895,7 @@ add_header_lines <- function(x, values = character(0), top = TRUE) {
895895
#' spans all columns (all cells merged into one). Useful for adding
896896
#' footnotes or source notes below the table.
897897
#' @inheritParams add_header_lines
898-
#' @family functions for row and column operations in a flextable
898+
#' @family table_structure
899899
#' @examples
900900
#' ft_1 <- flextable(head(iris))
901901
#' ft_1 <- add_footer_lines(ft_1,
@@ -1018,7 +1018,7 @@ set_part_df <- function(x, mapping = NULL, key = "col_keys", part) {
10181018
#' ft_1 <- theme_vanilla(ft_1)
10191019
#' ft_1 <- fix_border_issues(ft_1)
10201020
#' ft_1
1021-
#' @family functions for row and column operations in a flextable
1021+
#' @family table_structure
10221022
set_header_df <- function(x, mapping = NULL, key = "col_keys") {
10231023
if (!inherits(x, "flextable")) {
10241024
stop(sprintf("Function `%s` supports only flextable objects.", "set_header_df()"))
@@ -1077,7 +1077,7 @@ set_footer_df <- function(x, mapping = NULL, key = "col_keys") {
10771077
#' to use for splitting.
10781078
#' @param fixed logical. If TRUE match `split` exactly,
10791079
#' otherwise use regular expressions.
1080-
#' @family functions for row and column operations in a flextable
1080+
#' @family table_structure
10811081
#' @examples
10821082
#' library(flextable)
10831083
#'

R/body_add_flextable.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#' @title Add flextable into a Word document
33
#' @description Add a flextable into a Word document
44
#' created with 'officer'.
5+
#' @family officer_integration
56
#'
67
#' @details
78
#' Use the [paginate()] function to define whether the table should
@@ -149,6 +150,7 @@ body_add_flextable <- function(x, value,
149150

150151
#' @export
151152
#' @title Add flextable at bookmark location in a Word document
153+
#' @family officer_integration
152154
#' @description
153155
#' Use this function if you want to replace a paragraph containing
154156
#' a bookmark with a flextable. As a side effect, the bookmark will be lost.

R/compose.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
#' ft_2 <- autofit(ft_2)
5555
#' ft_2
5656
#' @export
57-
#' @family functions for mixed content paragraphs
57+
#' @family cell_content_composition
5858
#' @seealso [fp_text_default()], [as_chunk()], [as_b()], [as_word_field()], [labelizor()]
5959
compose <- function(x, i = NULL, j = NULL, value, part = "body", use_dot = FALSE) {
6060
if (!inherits(x, "flextable")) {
@@ -160,6 +160,7 @@ mk_par <- compose
160160
#' )
161161
#'
162162
#' ft_1
163+
#' @family cell_content_composition
163164
labelizor <- function(x, j = NULL, labels, part = "all") {
164165
if (!inherits(x, "flextable")) {
165166
stop(sprintf("Function `%s` supports only flextable objects.", "labelizor()"))

R/defaults.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ flextable_global$defaults <- default_flextable_settings
131131
#' ft_2
132132
#'
133133
#' do.call(set_flextable_defaults, old)
134-
#' @family functions related to themes
134+
#' @family themes_and_defaults
135135
#' @importFrom utils modifyList
136136
set_flextable_defaults <- function(
137137
font.family = NULL,
@@ -327,7 +327,7 @@ init_flextable_defaults <- function() {
327327
#' @return a list containing default values.
328328
#' @examples
329329
#' get_flextable_defaults()
330-
#' @family functions related to themes
330+
#' @family themes_and_defaults
331331
get_flextable_defaults <- function() {
332332
x <- flextable_global$defaults
333333
class(x) <- "flextable_defaults"
@@ -403,7 +403,7 @@ print.flextable_defaults <- function(x, ...) {
403403
#'
404404
#' init_flextable_defaults()
405405
#'
406-
#' @family functions for defining formatting properties
406+
#' @family default_formatting_properties
407407
#' @seealso [as_chunk()], [compose()], [append_chunks()], [prepend_chunks()]
408408
fp_text_default <- function(color = flextable_global$defaults$font.color,
409409
font.size = flextable_global$defaults$font.size,
@@ -460,7 +460,7 @@ fp_text_default <- function(color = flextable_global$defaults$font.color,
460460
#'
461461
#' init_flextable_defaults()
462462
#'
463-
#' @family functions for defining formatting properties
463+
#' @family default_formatting_properties
464464
#' @seealso [hline()], [vline()]
465465
fp_border_default <- function(
466466
color = flextable_global$defaults$border.color,

R/df_printer.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#' Default to TRUE.
4040
#' * `ft_color_coltype`: Color to use for column types.
4141
#' Default to "#999999".
42-
#' @family flextable print function
42+
#' @family flextable_output_export
4343
#' @examples
4444
#' df_printer(head(mtcars))
4545
df_printer <- function(dat, ...) {
@@ -79,6 +79,7 @@ df_printer <- function(dat, ...) {
7979
#' flextable::use_df_printer()
8080
#' ```
8181
#' @seealso [df_printer()], [flextable()]
82+
#' @family flextable_configuration
8283
use_df_printer <- function() {
8384
registerS3method("knit_print", "data.frame", df_printer)
8485
registerS3method("knit_print", "data.table", df_printer)

0 commit comments

Comments
 (0)