Skip to content

Commit

Permalink
Join named regions docs (#777)
Browse files Browse the repository at this point in the history
* Join named regions docs now that wb_get_named_regions() is a wrapper.

* Update _pkgdown.yml
  • Loading branch information
olivroy committed Aug 31, 2023
1 parent 54e0bfe commit 9fab5f6
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 88 deletions.
4 changes: 2 additions & 2 deletions R/class-workbook-wrappers.R
Original file line number Diff line number Diff line change
Expand Up @@ -1703,15 +1703,15 @@ wb_set_order <- function(wb, sheets) {
#' @param sheet A name or index of a worksheet
#' @param dims Worksheet cell range of the region ("A1:D4").
#' @param name Name for region. A character vector of length 1. Note that region
#' names musts be case-insensitive unique.
#' names must be case-insensitive unique.
#' @param overwrite Boolean. Overwrite if exists? Default to `FALSE`.
#' @param local_sheet If `TRUE` the named region will be local for this sheet
#' @param comment description text for named region
#' @param hidden Should the named region be hidden?
#' @param custom_menu,description,is_function,function_group_id,help,local_name,publish_to_server,status_bar,vb_procedure,workbook_parameter,xml Unknown XML feature
#' @param ... additional arguments
#' @returns A workbook, invisibly.
#' @family worksheet content functions
#' @seealso [wb_get_named_regions()]
#' @examples
#' ## create named regions
#' wb <- wb_workbook()
Expand Down
30 changes: 4 additions & 26 deletions R/get-named-regions.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,36 +54,14 @@ get_named_regions_tab <- function(wb) {
)
}

#' Get named regions in a workbook
#'
#' @returns A vector of named regions in `x`.
#' @param wb A `wbWorkbook` object
#' @param tables Should data tables be included in the result?
#' @param x deprecated. Use `wb`. For Excel input use [wb_load()] to first load
#' @rdname named_region-wb
#' @param tables Should included both data tables and named regions in the result?
#' @param x Deprecated. Use `wb`. For Excel input use [wb_load()] to first load
#' the xlsx file as a workbook.
#' @seealso [wb_add_named_region()], [wb_get_tables()]
#' @seealso [wb_get_tables()]
#' @returns A data frame with the all named regions in `wb`. Or `NULL`, if none are found.
#' @export
#' @examples
#' wb <- wb_workbook()
#' wb$add_worksheet("Sheet 1")
#'
#' ## specify region
#' wb$add_data(x = iris, start_col = 1, start_row = 1)
#' wb$add_named_region(
#' name = "iris",
#' dims = wb_dims(x = iris)
#' )$add_data(sheet = 1, x = iris, name = "iris2", start_col = 10)
#' ## From Workbook object
#' wb_get_named_regions(wb)
#' # Use this info to extract the data frame
#' df <- wb$to_df(named_region = "iris2")
#' head(df)
#'
#' # Extract tables and named regions
#' wb$add_worksheet()$add_data_table(x = iris)
#'
#' wb$get_named_regions(tables = TRUE)
#'
#' # Extract named regions from a file
#' out_file <- temp_xlsx()
Expand Down
1 change: 0 additions & 1 deletion _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ reference:
- wb_protect
- wb_get_tables
- wb_remove_tables
- wb_get_named_regions

- title: Workbook editing helpers
desc: >
Expand Down
27 changes: 25 additions & 2 deletions man/named_region-wb.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 0 additions & 57 deletions man/wb_get_named_regions.Rd

This file was deleted.

0 comments on commit 9fab5f6

Please sign in to comment.