Skip to content

Commit

Permalink
export internal dims helpers.closes #652
Browse files Browse the repository at this point in the history
  • Loading branch information
JanMarvin committed Jun 16, 2023
1 parent eecb6a8 commit 5607287
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 4 deletions.
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export(current_sheet)
export(dataframe_to_dims)
export(delete_data)
export(dims_to_dataframe)
export(dims_to_rowcol)
export(fmt_txt)
export(get_cell_refs)
export(get_date_origin)
Expand All @@ -39,6 +40,7 @@ export(read_sheet_names)
export(read_xlsx)
export(read_xml)
export(remove_comment)
export(rowcol_to_dims)
export(style_mgr)
export(styles_on_sheet)
export(temp_xlsx)
Expand Down
15 changes: 11 additions & 4 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,15 @@ random_string <- function(n = 1, length = 16, pattern = "[A-Za-z0-9]", keep_seed
return(res)
}

#' row and col to dims
#' dims helpers
#' @description Internal helpers to (de)construct a dims argument from/to a row
#' and column vector. Exported for user convenience.
#' @name dims_helper
#' @param x a dimension object "A1" or "A1:A1"
#' @param as_integer optional if the output should be returned as interger
#' @noRd
#' @examples
#' dims_to_rowcol("A1:J10")
#' @export
dims_to_rowcol <- function(x, as_integer = FALSE) {

dims <- x
Expand Down Expand Up @@ -230,10 +235,12 @@ rowcol_to_dim <- function(row, col) {
stringi::stri_join(min_col, min_row)
}

#' row and col to dims
#' @rdname dims_helper
#' @param row a numeric vector of rows
#' @param col a numeric or character vector of cols
#' @noRd
#' @examples
#' rowcol_to_dims(1:10, 1:10)
#' @export
rowcol_to_dims <- function(row, col) {

# no assert for col. will output character anyways
Expand Down
29 changes: 29 additions & 0 deletions man/dims_helper.Rd

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

0 comments on commit 5607287

Please sign in to comment.