Skip to content

Commit

Permalink
Final reordering in pkgdown (#768)
Browse files Browse the repository at this point in the history
* Make help topics easier to show in fn index

* Revert unintended

* revert more

* revert

* revert

* revert

* revert

* revert

* Tweaks to pkgdown
* separate content and styling
* move down the more complex `chart_xml and drawing functions
* Add more content to first level as it tells a story of what order things should happen? I guess
  • Loading branch information
olivroy committed Aug 24, 2023
1 parent 2d48564 commit f424a8e
Show file tree
Hide file tree
Showing 30 changed files with 299 additions and 270 deletions.
74 changes: 36 additions & 38 deletions R/class-workbook-wrappers.R
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ wb_freeze_pane <- function(
#' @param rows Indices of rows to set / remove (if any) custom height.
#' @param heights Heights to set `rows` to specified in a spreadsheet column height units.
#' @param hidden Option to hide rows. A logical vector of length 1 or length of `rows`
#' @name wb_row_heights
#' @name row_heights-wb
#' @family workbook wrappers
#' @family worksheet content functions
#'
Expand All @@ -835,13 +835,13 @@ wb_freeze_pane <- function(
#' ## remove any custom row heights in row 1
#' wb$remove_row_heights(sheet = 1, rows = 1)
NULL
#' @rdname wb_row_heights
#' @rdname row_heights-wb
#' @export
wb_set_row_heights <- function(wb, sheet = current_sheet(), rows, heights = NULL, hidden = FALSE) {
assert_workbook(wb)
wb$clone()$set_row_heights(sheet = sheet, rows, heights, hidden)
}
#' @rdname wb_row_heights
#' @rdname row_heights-wb
#' @export
wb_remove_row_heights <- function(wb, sheet = current_sheet(), rows) {
assert_workbook(wb)
Expand Down Expand Up @@ -900,10 +900,10 @@ wb_remove_row_heights <- function(wb, sheet = current_sheet(), rows) {
#'
#' ## remove column widths in columns 1 to 20
#' wb_remove_col_widths(wb, 1, cols = 1:20)
#' @name wb_col_widths
#' @name col_widths-wb
NULL

#' @rdname wb_col_widths
#' @rdname col_widths-wb
#' @export
wb_set_col_widths <- function(wb, sheet = current_sheet(), cols, widths = 8.43, hidden = FALSE) {
assert_workbook(wb)
Expand All @@ -915,7 +915,7 @@ wb_set_col_widths <- function(wb, sheet = current_sheet(), cols, widths = 8.43,
hidden = hidden
)
}
#' @rdname wb_col_widths
#' @rdname col_widths-wb
#' @export
wb_remove_col_widths <- function(wb, sheet = current_sheet(), cols) {
assert_workbook(wb)
Expand Down Expand Up @@ -1136,7 +1136,7 @@ wb_remove_worksheet <- function(wb, sheet = current_sheet()) {
#' @param ... Additional arguments
#' @family workbook styling functions
#' @family workbook wrappers
#' @name wb_base_font
#' @name base_font-wb
#' @examples
#' ## create a workbook
#' wb <- wb_workbook()
Expand All @@ -1154,7 +1154,7 @@ wb_remove_worksheet <- function(wb, sheet = current_sheet()) {
#'
NULL
#' @export
#' @rdname wb_base_font
#' @rdname base_font-wb
wb_set_base_font <- function(
wb,
font_size = 11,
Expand All @@ -1171,7 +1171,7 @@ wb_set_base_font <- function(
)
}
#' @export
#' @rdname wb_base_font
#' @rdname base_font-wb
wb_get_base_font <- function(wb) {
# TODO all of these class checks need to be cleaned up
assert_workbook(wb)
Expand Down Expand Up @@ -1731,10 +1731,10 @@ wb_set_order <- function(wb, sheets) {
#' df <- wb_to_df(wb, named_region = "iris")
#' head(df)
#'
#' @name wb_named_region
#' @name named_region-wb
NULL

#' @rdname wb_named_region
#' @rdname named_region-wb
#' @export
wb_add_named_region <- function(
wb,
Expand Down Expand Up @@ -1782,7 +1782,7 @@ wb_add_named_region <- function(
)
}

#' @rdname wb_named_region
#' @rdname named_region-wb
#' @export
wb_remove_named_region <- function(wb, sheet = current_sheet(), name = NULL) {
assert_workbook(wb)
Expand Down Expand Up @@ -1837,16 +1837,16 @@ wb_remove_named_region <- function(wb, sheet = current_sheet(), name = NULL) {
#' ## remove filters
#' wb_remove_filter(wb, 1:2) ## remove filters
#' wb_remove_filter(wb, 3) ## Does not affect tables!
#' @name wb_filter
#' @name filter-wb
#' @family worksheet content functions
NULL
#' @rdname wb_filter
#' @rdname filter-wb
#' @export
wb_add_filter <- function(wb, sheet = current_sheet(), rows, cols) {
assert_workbook(wb)
wb$clone()$add_filter(sheet = sheet, rows = rows, cols = cols)
}
#' @rdname wb_filter
#' @rdname filter-wb
#' @export
wb_remove_filter <- function(wb, sheet = current_sheet()) {
assert_workbook(wb)
Expand Down Expand Up @@ -1982,18 +1982,18 @@ wb_add_data_validation <- function(
#' wb$set_sheet_visibility(2, FALSE) ## hide sheet 2
#' wb$set_sheet_visibility(3, "hidden") ## hide sheet 3
#' wb$set_sheet_visibility(3, "veryHidden") ## hide sheet 3 from UI
#' @name wb_sheet_visibility
#' @name sheet_visibility-wb
NULL

#' @rdname wb_sheet_visibility
#' @rdname sheet_visibility-wb
#' @param wb A `wbWorkbook` object
#' @export
wb_get_sheet_visibility <- function(wb) {
assert_workbook(wb)
wb$get_sheet_visibility()
}

#' @rdname wb_sheet_visibility
#' @rdname sheet_visibility-wb
#' @param sheet Worksheet identifier
#' @param value a logical/character vector the same length as sheet,
#' if providing a character vector, you can provide any of "hidden", "visible", or "veryHidden"
Expand Down Expand Up @@ -2125,11 +2125,12 @@ wb_remove_tables <- function(wb, sheet = current_sheet(), table, remove_data = T
#' wb <- wb_group_cols(wb, "AirPass", 8:10, collapsed = TRUE)
#' wb <- wb_group_cols(wb, "AirPass", 11:13)
#'
#' @name wb_grouping
#' @name grouping-wb
#' @family workbook wrappers
NULL

#' @export
#' @rdname wb_grouping
#' @rdname grouping-wb
wb_group_cols <- function(wb, sheet = current_sheet(), cols, collapsed = FALSE, levels = NULL) {
assert_workbook(wb)
wb$clone()$group_cols(
Expand All @@ -2141,15 +2142,15 @@ wb_group_cols <- function(wb, sheet = current_sheet(), cols, collapsed = FALSE,
}

#' @export
#' @rdname wb_grouping
#' @rdname grouping-wb
wb_ungroup_cols <- function(wb, sheet = current_sheet(), cols) {
assert_workbook(wb)
wb$clone()$ungroup_cols(sheet = sheet, cols = cols)
}


#' @export
#' @rdname wb_grouping
#' @rdname grouping-wb
#' @examples
#' ### create grouping levels
#' grp_rows <- list(
Expand Down Expand Up @@ -2184,7 +2185,7 @@ wb_group_rows <- function(wb, sheet = current_sheet(), rows, collapsed = FALSE,
}

#' @export
#' @rdname wb_grouping
#' @rdname grouping-wb
wb_ungroup_rows <- function(wb, sheet = current_sheet(), rows) {
assert_workbook(wb)
wb$clone()$ungroup_rows(sheet = sheet, rows = rows)
Expand Down Expand Up @@ -2217,33 +2218,33 @@ wb_ungroup_rows <- function(wb, sheet = current_sheet(), rows) {
#' the `wbWorkbook` object
#' * `wb_get_creators()` returns a `character` vector of creators
#'
#' @name wb_creators
#' @name creators-wb
#' @family workbook wrappers
NULL

#' @rdname wb_creators
#' @rdname creators-wb
#' @export
#' @param creators A character vector of names
wb_add_creators <- function(wb, creators) {
assert_workbook(wb)
wb$clone()$add_creators(creators)
}

#' @rdname wb_creators
#' @rdname creators-wb
#' @export
wb_set_creators <- function(wb, creators) {
assert_workbook(wb)
wb$clone()$set_creators(creators)
}

#' @rdname wb_creators
#' @rdname creators-wb
#' @export
wb_remove_creators <- function(wb, creators) {
assert_workbook(wb)
wb$clone()$remove_creators(creators)
}

#' @rdname wb_creators
#' @rdname creators-wb
#' @export
wb_get_creators <- function(wb) {
assert_workbook(wb)
Expand All @@ -2266,21 +2267,21 @@ wb_get_creators <- function(wb) {
#' @param old The name (or index) of the old sheet name. If `NULL` will assume
#' all worksheets are to be renamed.
#' @param new The name of the new sheet
#' @name wb_sheet_names
#' @name sheet_names-wb
#' @returns
#' * `set_`: The `wbWorkbook` object.
#' * `get_`: A named character vector of sheet names in order. The
#' names represent the original value of the worksheet prior to any character
#' substitutions.
#'
NULL
#' @rdname wb_sheet_names
#' @rdname sheet_names-wb
#' @export
wb_set_sheet_names <- function(wb, old = NULL, new) {
assert_workbook(wb)
wb$clone()$set_sheet_names(old = old, new = new)
}
#' @rdname wb_sheet_names
#' @rdname sheet_names-wb
#' @param escape Should the xml special characters be escaped?
#' @export
wb_get_sheet_names <- function(wb, escape = FALSE) {
Expand Down Expand Up @@ -2976,7 +2977,6 @@ wb_add_dxfs_style <- function(
#' @param ... additional arguments
#' @returns The Workbook object, invisibly.
#' @seealso [wb_comment()], [wb_add_thread()]
#' @name wb_add_comment
#' @keywords comments
#' @examples
#' wb <- wb_workbook()
Expand All @@ -2992,8 +2992,6 @@ wb_add_dxfs_style <- function(
#' # Works with formatted text also.
#' formatted_text <- fmt_txt("bar", underline = TRUE)
#' wb$add_comment(dims = "B5", comment = formatted_text)
NULL
#' @rdname wb_add_comment
#' @export
wb_add_comment <- function(
wb,
Expand Down Expand Up @@ -3481,13 +3479,13 @@ wb_set_sheetview <- function(
#' wb_get_active_sheet(wb)
#' # change the selected sheet to Sheet2
#' wb <- wb_set_active_sheet(wb, sheet = "Sheet2")
#' @name wb_active_sheet
#' @name active_sheet-wb
wb_get_active_sheet <- function(wb) {
assert_workbook(wb)
wb$get_active_sheet()
}

#' @rdname wb_active_sheet
#' @rdname active_sheet-wb
#' @param sheet a sheet name of the workbook
#' @export
wb_set_active_sheet <- function(wb, sheet) {
Expand All @@ -3496,14 +3494,14 @@ wb_set_active_sheet <- function(wb, sheet) {
wb$clone()$set_active_sheet(sheet = sheet)
}

#' @rdname wb_active_sheet
#' @rdname active_sheet-wb
#' @export
wb_get_selected <- function(wb) {
assert_workbook(wb)
wb$get_selected()
}

#' @rdname wb_active_sheet
#' @rdname active_sheet-wb
#' @export
wb_set_selected <- function(wb, sheet) {
assert_workbook(wb)
Expand Down
2 changes: 0 additions & 2 deletions R/openxlsx2-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
#' Based on a powerful XML library and focusing on modern programming flows in pipes
#' or chains, `openxlsx2` allows to break many new ground.
#'
#' @name openxlsx2-package
#' @docType package
#' @useDynLib openxlsx2, .registration=TRUE
#'
#' @import Rcpp
Expand Down

0 comments on commit f424a8e

Please sign in to comment.