Initializing help system before first use

Rset

Rset


Purpose
Assign a Mosel value to an R object.
Synopsis
procedure Rset(dst:string, value:[set|array|list of] boolean|integer|real|string)
Arguments
dst 
An R variable name
value 
The Mosel value to be assigned to dst
Example
The following example assigns values 1.2, "hello" and an array with numbers 1 to 6 to the R objects a_num, a_string and a_vec respectively:
 Rset('a_num', 1.2)
 Rset('a_string', 'hello')
 Rset("a_vec", 1..6)        ! An R vector with real values 1 to 6
 Rset("dim(a_vec)", [2,3])  ! Change its dimensions into a 2x3 matrix
Further information
1. A new temporary R entity is created from value and then assigned to dst, unless value is a scalar and dst is an existing R entity of the corresponding type, in which case dst is just set to the new value
2. Argument dst can represent any assignable expression (including subsetting and attributes).
3. The type of argument value can be any elementary Mosel type, or an array, list or set of these (compositions are not supported).
4. When value is an array, for each of the array's dimensions, its index values are exported into the corresponding R array's names or dimnames attribute (after conversion to string) unless the indices are integer values from 1 to that dimension size.
5. If value is a dynamic array, only the existing values are copied to R and the remaining array entries are set to NA (Not Available).
Related topics