Example of building SciDB array with literals for SciDB-R


#1

The following example from SciDB documentation builds a SciDB array with literals:

iquery -aq "build(< a1 : double, a2 : string > [r=0:3,100,0, c=0:0,100,0], 
          '[  [ (1, \'One\')] , 
              [ (2, \'Two\')] , 
              [ (3, \'Three\')] , 
              [ (4, \'Four\')]  
            ]',
          true)"

The output is:

{r,c} a1,a2
{0,0} 1,'One'
{1,0} 2,'Two'
{2,0} 3,'Three'
{3,0} 4,'Four'

In SciDB-R, you need to add extra escape characters:

a = scidb("build(< a1 : double, a2 : string > [r=0:3,100,0, c=0:0,100,0], 
          '[  [ (1, \\'One\\')] , 
              [ (2, \\'Two\\')] , 
              [ (3, \\'Three\\')] , 
              [ (4, \\'Four\\')]  
            ]',
          true)")