Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions R/workbook_write_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,10 @@ Workbook$methods(writeData = function(df, sheet, startRow, startCol, colNames, c




if(keepNA){
if (is.character(keepNA)) {
t[is.na(v)] <- 4L
v[is.na(v)] <- keepNA
} else if (keepNA) {
t[is.na(v)] <- 4L
v[is.na(v)] <- "#N/A"
}else{
Expand Down
2 changes: 1 addition & 1 deletion R/writeData.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#' \item{\bold{slantDashDot}}{ slanted dash-dot border}
#' }
#' @param withFilter If \code{TRUE}, add filters to the column name row. NOTE can only have one filter per worksheet.
#' @param keepNA If \code{TRUE}, NA values are converted to #N/A in Excel else NA cells will be empty.
#' @param keepNA If \code{TRUE}, NA values are converted to #N/A in Excel else NA cells will be empty. If a string is passed, that string is used instead of "#N/A".
#' @param name If not NULL, a named region is defined.
#' @param sep Only applies to list columns. The separator used to collapse list columns to a character vector e.g. sapply(x$list_column, paste, collapse = sep).
#' @seealso \code{\link{writeDataTable}}
Expand Down
2 changes: 1 addition & 1 deletion R/writeDataTable.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#' @param tableName name of table in workbook. The table name must be unique.
#' @param headerStyle Custom style to apply to column names.
#' @param withFilter If \code{TRUE}, columns with have filters in the first row.
#' @param keepNA If \code{TRUE}, NA values are converted to #N/A in Excel else NA cells will be empty.
#' @param keepNA If \code{TRUE}, NA values are converted to #N/A in Excel else NA cells will be empty. If a string is passed, that string is used instead of "#N/A".
#' @param sep Only applies to list columns. The separator used to collapse list columns to a character vector e.g. sapply(x$list_column, paste, collapse = sep).
#' @param stack If \code{TRUE} the new style is merged with any existing cell styles. If FALSE, any
#' existing style is replaced by the new style.
Expand Down
6 changes: 3 additions & 3 deletions R/writexlsx.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#' between each column. If "\code{all}" all cell borders are drawn.}
#' \item{\bold{borderColour}}{ Colour of cell border}
#' \item{\bold{borderStyle}}{ Border line style.}
#' \item{\bold{keepNA}} {If \code{TRUE}, NA values are converted to #N/A in Excel else NA cells will be empty. Defaults to FALSE.}
#' \item{\bold{keepNA}} {If \code{TRUE}, NA values are converted to #N/A in Excel else NA cells will be empty. Defaults to FALSE. If a string is passed, that string is used instead of #N/A.}
#' }
#'
#' \bold{freezePane Parameters}
Expand Down Expand Up @@ -319,8 +319,8 @@ write.xlsx <- function(x, file, asTable = FALSE, ...){

keepNA <- FALSE
if("keepNA" %in% names(params)){
if(!"logical" %in% class(keepNA)){
stop("keepNA must be a logical.")
if(!"logical" %in% class(keepNA) && !"character" %in% class(keepNA)){
stop("keepNA must be a logical or a string.")
}else{
keepNA <- params$keepNA
}
Expand Down
2 changes: 1 addition & 1 deletion man/write.xlsx.Rd

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

2 changes: 1 addition & 1 deletion man/writeData.Rd

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

2 changes: 1 addition & 1 deletion man/writeDataTable.Rd

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