def R (func):
    rfunc = rinterface.globalenv.get (func)
    def f (*args, **kwargs):
        argList = []
        kwargDict = {}
        for a in args:
            argList.append (rType (a))
        for k, v in kwargs.iteritems ():
            kwargDict[k] = rType (v)
        rResult = rfunc (*argList, **kwargDict)
        length = len (rResult)
        #if not hasattr (rResult, '__iter__'):
        #    return None
        #if length == 0:
        #    return None
        #elif length == 1:
        #    return rResult[0]
        # else:
        results = []
        count = 0
        while count < length:
            results.append (rResult[count])
            count += 1
        return results
        """for x in rResult:
            results.append (x)
        if len (results) == 0:
            return None
        elif len (results) == 1:
            return results[0]
        else:
            return results"""
    return f
dataset/ETHPy150Open dotskapes/dotSkapes/modules/geo/r.py/R/original