def numpy2r(mat):
    num_rows = mat.shape[0]
    data = mat.T.flatten()
    data = ["%f"%each for each in data]
    data = "c(" + ",".join(data) + ")"
    return "matrix(%s,%d)"%(data,num_rows)
Convert a matrix into a string that can be executed in R.
dataset/ETHPy150Open bolme/pyvision/src/pyvision/__init__.py/numpy2r