Skip to content
Advertisement

Calling an R package function with rpy2

I’m new to R and need to pass string data from a pandas dataframe to a function in R. This function accepts nested lists of strings, such as:

JavaScript

The code

JavaScript

I tried two approaches:

1)

JavaScript

That yielded KeyError: <class 'list'> error message.

2)

JavaScript

That yielded the error message:

JavaScript

I checked if d is a list or not:

JavaScript

I’d be grateful to get any suggestion regarding how to call ontology_similarity.get_sim_grid().
Thanks.

Advertisement

Answer

Eventually I used robjects.r to call the R package from R instead of from Python, and it worked.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement