Initializing help system before first use

Rgetarr

Rgetarr


Purpose
Get the resulting array of an R expression.
Synopsis
procedure Rgetarr(cmd:string, arr:array)
Arguments
cmd 
Statements to evaluate
arr 
Destination Mosel array
Example
The following example loads the R cars example dataset into the Mosel array cars:
 declarations
  cars:array(range, set of string) of integer
 end-declarations
 Rgetarr('as.matrix(datasets::cars)',cars)
Further information
1. If cmd contains more than one statement, the returned value is the result of the last one.
2. The Mosel array arr must have the same number of dimensions as the R array; NA entries in R are skipped and corresponding entries in arr are left unchanged (note that arr is not cleared before loading R data).
3. Supported index types for the arr array are string and integer. In the case of strings, the R array must have a valid names or dimnames attribute for the corresponding dimension; in the case of integers, the R integer indices (1 to n) are used. All entries of the R array are converted to the same type as the destination array within R.
Related topics