asCOMArray: Create COM SAFEARRAY from R matrix

View source: R/com.R

asCOMArrayR Documentation

Create COM SAFEARRAY from R matrix

Description

This creates a COM array from the contents of a two-dimensional R matrix or data frame. This can be used within R to explicitly coerce an R object before it is passed to the COM mechanism as an argument or return value of a function. Otherwise, the automatic converter mechanism creates a dynamic COM object that points to this S object which loses no information (e.g. column or row names, etc.) This currently only handles basic types in S, i.e. integer, numeric, logical and character elements. In the future, we will provide functions for creating an arbitrary SAFEARRAY and populating it in steps directly from R.

Usage

asCOMArray(obj)

Arguments

obj

an S object that is converted to a matrix and whose resulting contents are copied into the COM array.

Value

An object which is an external pointer to the newly created SAFEARRAY.

Author(s)

Duncan Temple Lang (duncan@r-project.org)

References

http://www.omegahat.net/RDCOMClient http://www.omegahat.net/RDCOMServer http://www.omegahat.net/SWinTypeLibs

See Also

.COM createCOMObject in RDCOMServer

Examples

## Not run: 
  r = sheet$Range("A1:C10")
  r[["Value"]] <- asCOMArray(matrix(rnorm(30, 10, 3)))

## End(Not run)

omegahat/RDCOMClient documentation built on July 24, 2022, 5:45 a.m.