Learn R Programming

XLConnect (version 1.1.0)

xlcCall: Automatic argument vectorization, default Java exception and warnings handling for XLConnect

Description

Performs automatic argument vectorization, provides default Java exception and warnings handling for XLConnect.

Usage

xlcCall(obj, fun, ..., .recycle = TRUE, 
  .simplify = TRUE, .checkWarnings = TRUE, .withAttributes = FALSE)

Value

Result of the specified function by calling it with the vectorized argument list.

Arguments

obj

XLConnect S4 object (e.g workbook, cellstyle) which has a slot jobj representing a rJava jobjRef object whose method represented by the argument fun should be called.

fun

Name of Java method to be called.

...

Arguments to the Java method to be called.

.recycle

If TRUE (default), arguments passed through ... will be automatically vectorized using mapply and fun will be called the appropriate amount of times. If FALSE, no vectorization will take place in R and fun will be called once only. This may be used to implement vectorization on the Java side.

.simplify

Only relevant if .recycle = TRUE. Argument to internal mapply to set if there should be an attempt to reduce the result to a vector or matrix.

.checkWarnings

Whether to check for warnings registered on the underlying Java object.

.withAttributes

Whether the function being called returns a wrapped Java object with attributes. If TRUE:

  • the object will be unwrapped

  • if option XLConnect.setCustomAttributes is TRUE, the attributes will be processed and set on the resulting R object.

Author

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

Details

This function makes use of mapply to perform automatic argument vectorization. Non-atomic arguments are wrapped in a list using wrapList first. The list of the resulting arguments is then being vectorized using mapply before the specified function is being called. The function call is wrapped with jTryCatch to catch Java exceptions. Further, any warnings are retrieved from the Java side and are logged via R's standard warning mechanism.

See Also

wrapList, jTryCatch