From 9a22fbaf85ae077104c00ea13051f2133366d69e Mon Sep 17 00:00:00 2001 From: olivroy Date: Tue, 22 Aug 2023 00:18:26 -0400 Subject: [PATCH] Tweaks --- R/class-workbook-wrappers.R | 14 +++++++------- R/read.R | 6 ++++++ man/wb_add_data.Rd | 6 +++--- man/wb_add_data_table.Rd | 6 +++--- man/wb_save.Rd | 4 ++-- man/wb_to_df.Rd | 5 +++++ man/wb_workbook.Rd | 4 ++-- man/write_data.Rd | 6 +++--- man/write_datatable.Rd | 6 +++--- 9 files changed, 34 insertions(+), 23 deletions(-) diff --git a/R/class-workbook-wrappers.R b/R/class-workbook-wrappers.R index 65b7a059b..17dbc0bfa 100644 --- a/R/class-workbook-wrappers.R +++ b/R/class-workbook-wrappers.R @@ -1,7 +1,7 @@ #' Create a new Workbook object #' -#' Create a new Workbook object +#' Initialize a [wbWorkbook] object. You can set workbook properties as well. #' #' `theme` can be one of #' "Atlas", "Badge", "Berlin", "Celestial", "Crop", "Depth", "Droplet", @@ -16,7 +16,7 @@ #' @param theme Optional theme identified by string or number. #' See **Details** for options. #' @param ... additional arguments -#' @return A [wbWorkbook] object +#' @return A `wbWorkbook` object #' #' @export #' @family workbook wrappers @@ -57,8 +57,8 @@ wb_workbook <- function( #' #' @param wb A `wbWorkbook` object to write to file #' @param file A path to save the workbook to -#' @param overwrite If `FALSE`, will not overwrite when `path` exists -#' @param path Deprecated argument previously used for `file`. Please use `file` in new code. +#' @param overwrite If `FALSE`, will not overwrite when `file` already exists. +#' @param path Deprecated argument. Please use `file` in new code. #' #' @export #' @family workbook wrappers @@ -89,9 +89,9 @@ wb_save <- function(wb, file = NULL, overwrite = TRUE, path = NULL) { #' @param wb A Workbook object containing a worksheet. #' @param sheet The worksheet to write to. Can be the worksheet index or name. #' @param x Object to be written. For classes supported look at the examples. -#' @param dims Spreadsheet dimensions that will determine `start_col` and `start_row`: "A1", "A1:B2", "A:B" -#' @param start_col A vector specifying the starting column to write to. -#' @param start_row A vector specifying the starting row to write to. +#' @param dims Spreadsheet cell range that will determine `start_col` and `start_row`: "A1", "A1:B2", "A:B" +#' @param start_col A vector specifying the starting column to write `x` to. +#' @param start_row A vector specifying the starting row to write `x` to. #' @param array A bool if the function written is of type array #' @param col_names If `TRUE`, column names of `x` are written. #' @param row_names If `TRUE`, the row names of `x` are written. diff --git a/R/read.R b/R/read.R index f1a711b5e..182d61b85 100644 --- a/R/read.R +++ b/R/read.R @@ -15,6 +15,12 @@ #' * 2: date #' * 3: posixt (datetime) #' * 4: logical +#' +#' `read_xlsx()` will not pick up formulas added to a Workbook object +#' via [wb_add_formula()]. This is because only the formula is written and left +#' to be evaluated when the file is opened in a spreadsheet software. +#' Opening, saving and closing the file with Excel will resolve this. +#' #' @seealso [wb_get_named_regions()] #' #' @param file An xlsx file, [wbWorkbook] object or URL to xlsx file. diff --git a/man/wb_add_data.Rd b/man/wb_add_data.Rd index 5da49fc69..164eda2e8 100644 --- a/man/wb_add_data.Rd +++ b/man/wb_add_data.Rd @@ -31,11 +31,11 @@ wb_add_data( \item{x}{Object to be written. For classes supported look at the examples.} -\item{dims}{Spreadsheet dimensions that will determine \code{start_col} and \code{start_row}: "A1", "A1:B2", "A:B"} +\item{dims}{Spreadsheet cell range that will determine \code{start_col} and \code{start_row}: "A1", "A1:B2", "A:B"} -\item{start_col}{A vector specifying the starting column to write to.} +\item{start_col}{A vector specifying the starting column to write \code{x} to.} -\item{start_row}{A vector specifying the starting row to write to.} +\item{start_row}{A vector specifying the starting row to write \code{x} to.} \item{array}{A bool if the function written is of type array} diff --git a/man/wb_add_data_table.Rd b/man/wb_add_data_table.Rd index aa7964fbc..96de263a6 100644 --- a/man/wb_add_data_table.Rd +++ b/man/wb_add_data_table.Rd @@ -35,11 +35,11 @@ wb_add_data_table( \item{x}{A data frame} -\item{dims}{Spreadsheet dimensions that will determine \code{start_col} and \code{start_row}: "A1", "A1:B2", "A:B"} +\item{dims}{Spreadsheet cell range that will determine \code{start_col} and \code{start_row}: "A1", "A1:B2", "A:B"} -\item{start_col}{A vector specifying the starting column to write to.} +\item{start_col}{A vector specifying the starting column to write \code{x} to.} -\item{start_row}{A vector specifying the starting row to write to.} +\item{start_row}{A vector specifying the starting row to write \code{x} to.} \item{col_names}{If \code{TRUE}, column names of \code{x} are written.} diff --git a/man/wb_save.Rd b/man/wb_save.Rd index 6ffaea895..2102883b3 100644 --- a/man/wb_save.Rd +++ b/man/wb_save.Rd @@ -11,9 +11,9 @@ wb_save(wb, file = NULL, overwrite = TRUE, path = NULL) \item{file}{A path to save the workbook to} -\item{overwrite}{If \code{FALSE}, will not overwrite when \code{path} exists} +\item{overwrite}{If \code{FALSE}, will not overwrite when \code{file} already exists.} -\item{path}{Deprecated argument previously used for \code{file}. Please use \code{file} in new code.} +\item{path}{Deprecated argument. Please use \code{file} in new code.} } \value{ the \code{wbWorkbook} object, invisibly diff --git a/man/wb_to_df.Rd b/man/wb_to_df.Rd index 936914318..f6d58e43a 100644 --- a/man/wb_to_df.Rd +++ b/man/wb_to_df.Rd @@ -140,6 +140,11 @@ The \code{types} argument must be a named numeric. \item 3: posixt (datetime) \item 4: logical } + +\code{read_xlsx()} will not pick up formulas added to a Workbook object +via \code{\link[=wb_add_formula]{wb_add_formula()}}. This is because only the formula is written and left +to be evaluated when the file is opened in a spreadsheet software. +Opening, saving and closing the file with Excel will resolve this. } \examples{ ########################################################################### diff --git a/man/wb_workbook.Rd b/man/wb_workbook.Rd index f8fe26f93..a4e2533a1 100644 --- a/man/wb_workbook.Rd +++ b/man/wb_workbook.Rd @@ -27,10 +27,10 @@ See \strong{Details} for options.} \item{...}{additional arguments} } \value{ -A \link{wbWorkbook} object +A \code{wbWorkbook} object } \description{ -Create a new Workbook object +Initialize a \link{wbWorkbook} object. You can set workbook properties as well. } \details{ \code{theme} can be one of diff --git a/man/write_data.Rd b/man/write_data.Rd index 4272ded15..e984f9862 100644 --- a/man/write_data.Rd +++ b/man/write_data.Rd @@ -31,11 +31,11 @@ write_data( \item{x}{Object to be written. For classes supported look at the examples.} -\item{dims}{Spreadsheet dimensions that will determine \code{start_col} and \code{start_row}: "A1", "A1:B2", "A:B"} +\item{dims}{Spreadsheet cell range that will determine \code{start_col} and \code{start_row}: "A1", "A1:B2", "A:B"} -\item{start_col}{A vector specifying the starting column to write to.} +\item{start_col}{A vector specifying the starting column to write \code{x} to.} -\item{start_row}{A vector specifying the starting row to write to.} +\item{start_row}{A vector specifying the starting row to write \code{x} to.} \item{array}{A bool if the function written is of type array} diff --git a/man/write_datatable.Rd b/man/write_datatable.Rd index f79e4cbfc..852bb3f8a 100644 --- a/man/write_datatable.Rd +++ b/man/write_datatable.Rd @@ -35,11 +35,11 @@ write_datatable( \item{x}{A data frame} -\item{dims}{Spreadsheet dimensions that will determine \code{start_col} and \code{start_row}: "A1", "A1:B2", "A:B"} +\item{dims}{Spreadsheet cell range that will determine \code{start_col} and \code{start_row}: "A1", "A1:B2", "A:B"} -\item{start_col}{A vector specifying the starting column to write to.} +\item{start_col}{A vector specifying the starting column to write \code{x} to.} -\item{start_row}{A vector specifying the starting row to write to.} +\item{start_row}{A vector specifying the starting row to write \code{x} to.} \item{col_names}{If \code{TRUE}, column names of \code{x} are written.}