Initializing help system before first use

Rsetdf

Purpose
Assign a Mosel array to an R data.frame object.
Synopsis
procedure Rsetdf(dst:string, arr:array of boolean|integer|real|string)
Synopsis
procedure Rsetdf(dst:string, arr:array of boolean|integer|real|string, cname:list of string)
Arguments
dst 
An R variable name
arr 
The Mosel array to be assigned to dst
cname 
List of names to be assigned to the data.frame columns
Example
The following:
 declarations
  CITIES = {"LONDON", "NEW YORK", "ROME"}
  ZONES = 1..4
  myarray: dynamic array(ZONES, CITIES) of integer
 end-declarations
 myarray(1,'LONDON') := 8
 myarray(1,'ROME') := 3
 myarray(2,'NEW YORK') := 9
 Rsetdf("a_df", myarray, ['Zone','City','Value'])
 Rprint("a_df")
produces this output:
  Zone     City Value
1    1   LONDON     8
2    1     ROME     3
3    2 NEW YORK     9
Further information
1. A new R data.frame is created from arr and assigned to dst
2. The argument dst can represent any assignable expression (including subsetting and attributes).
3. The R data.frame is constructed with n+1 columns (where n is the number of dimensions of arr): one column for each of the array's indices, plus one column for the array's values; and one row for each existing value of the array.
4. Rows are numbered from 1 to the number of existing values of arr and column names are taken from the cname argument, when given.
5. Only the first n+1 strings from cname are used; if cname is shorter, then the right-most columns are left unnamed.
Related topics

© 2001-2022 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.