diff --git a/NAMESPACE b/NAMESPACE index 6be919114..b50f8c49b 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -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) @@ -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) diff --git a/R/utils.R b/R/utils.R index 2eee22d75..4280b527f 100644 --- a/R/utils.R +++ b/R/utils.R @@ -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 @@ -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 diff --git a/man/dims_helper.Rd b/man/dims_helper.Rd new file mode 100644 index 000000000..0410f8ae9 --- /dev/null +++ b/man/dims_helper.Rd @@ -0,0 +1,29 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/utils.R +\name{dims_helper} +\alias{dims_helper} +\alias{dims_to_rowcol} +\alias{rowcol_to_dims} +\title{dims helpers} +\usage{ +dims_to_rowcol(x, as_integer = FALSE) + +rowcol_to_dims(row, col) +} +\arguments{ +\item{x}{a dimension object "A1" or "A1:A1"} + +\item{as_integer}{optional if the output should be returned as interger} + +\item{row}{a numeric vector of rows} + +\item{col}{a numeric or character vector of cols} +} +\description{ +Internal helpers to (de)construct a dims argument from/to a row +and column vector. Exported for user convenience. +} +\examples{ +dims_to_rowcol("A1:J10") +rowcol_to_dims(1:10, 1:10) +}