Beispiel #1
0
def to_rData(variable):
    import pandas as pd
    import numpy as np
    from rpy2.robjects import FloatVector, int2ri, StrVector
    from rpy2.robjects import pandas2ri
    pandas2ri.activate()

    if type(variable) == pd.core.frame.DataFrame:
        output = pandas2ri.py2ri(variable)
    elif type(variable) == np.ndarray:
        output = numpy2ri(variable)
    elif type(variable) == list:
        output = FloatVector(variable)
    elif type(variable) == int:
        output = int2ri(variable)
    elif type(variable) == str:
        output = StrVector(variable)

    pandas2ri.deactivate()
Beispiel #2
0
def npint_py2ri(obj):
    return ro.int2ri(obj)
Beispiel #3
0
def npint_py2ri(obj):
    return ro.int2ri(obj)