Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

export internal dims helpers.closes #652 #653

Merged
merged 1 commit into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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.