setMissingValue-methods: Setting missing value identifiers

Description Usage Arguments Details Author(s) See Also Examples

Description

Defines the set of missing values (character or numeric) used when reading and writing data.

Usage

1
2
## S4 method for signature 'workbook,ANY'
setMissingValue(object,value)

Arguments

object

The workbook to use

value

vector or list of missing value identifiers (either character or numeric) that are recognized as missing (NA) when reading data. The first element of this vector will be used as missing value identifier when writing data. If value = NULL (default), missing values are represented by blank cells and only blank cells are recognized as missing.

Details

If there are no specific missing value identifiers defined the default behavior is to map missing values to blank (empty) cells. Otherwise, each string or numeric cell is checked if it matches one of the defined missing value identifiers. In addition, the first missing value identifier (i.e. the first element of the value argument) is used to represent missing values when writing data.
Note that the missing value identifiers have to be either character or numeric.

Author(s)

Martin Studer
Mirai Solutions GmbH https://mirai-solutions.ch

See Also

workbook, writeNamedRegion, writeWorksheet

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## Not run: 
# Load workbook (create if not existing)
wb <- loadWorkbook("missingValue.xlsx", create = TRUE)

# Create a worksheet named 'airquality'
createSheet(wb, name = "airquality")

# Create a named region called 'airquality' on the sheet called
# 'airquality'
createName(wb, name = "airquality", formula = "airquality!$A$1")

# Set the missing value string to 'missing'
setMissingValue(wb, value = "missing")

# Write built-in data set 'airquality' to the above defined named region
writeNamedRegion(wb, airquality, name = "airquality")

# Save workbook
saveWorkbook(wb)

# clean up 
file.remove("missingValue.xlsx")

## End(Not run)

XLConnect documentation built on Oct. 1, 2021, 5:06 p.m.