SET DCOM

From STX Wiki
< Programmer Guide‎ | Shell Items‎ | DCOM
Revision as of 15:05, 17 May 2010 by 193.171.195.8 (talk) (initial import)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

SET DCOM

The following SET commands are understood by the DCOM shell item:

INVOKEMETHOD

SET $#dcomItem INVOKEMETHOD MethodName [param_1 param_2 .... param_n]

Invoke a DCOM object method.

MethodName the name of the remote method
param_1 ... param_n parameters for the method MethodName


SETDATA

The following commands are specific to the R statistical program.SET $#dcomItem SETDATA R_var_name string /Constant

SET $#dcomItem SETDATA R_var_name variable [/Variable]

SET $#dcomItem SETDATA R_var_name table [index count][/Variable]

Create a variable and set its value and type, in an R workspace. SETDATA is a special method implemented for use with the R DCOM server. Currently the following types of variables are supported: string, number(float) and matrix. The maximum number of dimensions for a matrix is currently two.

R_var_name

The name of the variable to be created in the R workspace.
string
In conjunction with the option /Constant the string to assign to the variable R_var_name. If string is a numerical expression, the numerical value is assigned.
variable
The S_TOOLS-STx variable name, which contains the value to be assigned to R_var_name (the option /Variable can be used, but is optional).
table
The name of an S_TOOLS-STx table containing the values to be assigned to R_var_name. Note that by default only the column 0 is sent.
index
If a table is passed, the index of the first field to use in the table. The default is 0.
count
If a table is passed, the number of fields to read (starting from index). Note that all fields from index to count-1 must be numerical fields. The default is 1.

Example

///////////////////////////////////////////////////////////////////////////////
//
//  Macro:          DCOMSetData
//  Description:    Send a string to the statistical package R and tell R to
//                  edit the string (i.e. open a text file).
//  Usage:          DCOMSetData
//  Return:         0
//  Author:         Jonnie White
//  History:        2005-04-26
//                  
///////////////////////////////////////////////////////////////////////////////
[macro dcomsetdata]

    #dcom := $(new DCOM * 'StatConnectorSrv.StatConnector')
    if '$#dcom' == '*' em -1 ; Error creating R DCOM server

    $#dcom INVOKEMETHOD Init R
    if '$rc' > 0 em  $rc ; Failed to invoke Init R method

    #myStr := 'The quick brown fox jumps over the lazy dog'

    $#dcom SETDATA myStr #myStr
    if '$rc' > 0 em $rc ; failed to setdata the R variable 'myStr'

    $#dcom INVOKEMETHOD EvaluateNoReturn ' edit(myStr)'
    if '$rc' > 0 em $rc ; failed to evaluate 'edit(myStr)'

    $#DCOM SETDATA myStr '$#myStr' /Constant
    if '$rc' > 0 em $rc ; failed to setdata myStr #myStr

    $#dcom INVOKEMETHOD EvaluateNoReturn 'edit(myStr)'
    if '$rc' > 0 em $rc ; failed to evaluate 'edit(myStr)'

    delete $#dcom
exit 1 int 0

GETDATA

The following commands are specific to the R statistical program.SET $#dcomItem GETDATA R_var_name variable

SET $#dcomItem GETDATA R_var_name table [index{0} count{1}]

SET $#dcomItem GETDATA R_var_name value

Get the value of a variable in an R workspace. GETDATA is a special method implemented for use with the R DCOM server.

R_var_name
The name of a variable that exists in an R workspace.
variable
The name of an S_TOOLS-STx variable that will be assigned the value of R_var_name. The variable can receive string or number data.
table
The name of an S_TOOLS-STx table to receive values from R_var_name. Note that a table can only receive vector or matrix data.
index
The zero-based index of the table field to receive the first column of R_var_name.
count
The number of fields into which the data from R_var_name should be copied.
value
The name of an S_TOOLS-STx value item that will be assigned the value of R_var_name. The value item can receive string, number, vector or matrix data.

R

R is a language and environment for statistical computing and graphics. You can find more details on their homepage: http://www.r-project.org/

S_TOOLS-STx can communicate with R using the DCOM interface implemented in S_TOOLS-STx as a shell item (DCOM).

Note that if you are running R 2.2 or greater, you will need the 2.0 R (D)COM server.

Navigation menu

Personal tools