if (object instanceof Object[])
{
Object[] array = (Object[])object;
if (array.length == 0)
{
return new REXPList(new RList());
}
else if (array[0] instanceof String)
{
String[] strings = ListUtils.copyStringArray(array, new String[array.length]);
return new REXPString(strings);
}
else if (array[0] instanceof Number)
{
double[] doubles = ListUtils.copyDoubleArray(array, new double[array.length]);
return new REXPDouble(doubles);
}
else if (array[0] instanceof Object[]) // 2-d matrix
{
// handle 2-d matrix
RList rList = new RList();
for (Object item : array)
rList.add(getREXP(item));
try {
return REXP.createDataFrame(rList);
} catch (REXPMismatchException e) {
throw new RemoteException("Failed to Create Dataframe",e);