Reputation: 1
The aim is to import a list that I have created in R, in PyCharm. I would like to do so, without passing through an Excel where I should save my data.
I had found this library which executes the R code and then import the structures in PyCharm, but it's very slow. Have you got some suggestions or other ways to implement it?
import rpy2.robjects as ro
import rpy2.robjects.numpy2ri as numpy2ri
numpy2ri.activate()
ro.r('source("C:/Users/virgi/PycharmProjects/pythonProjectTesi/prova_functional.R")')
time_istants = np.array(ro.r['time_istants'])
all_predictions_map_r = ro.r['all_predictions_map']
vol = np.array(ro.r['vol'])
all_predictions_map = [np.array(all_predictions_map_r[i]) for i in range(len(all_predictions_map_r))]
print("time_istants:", time_istants)
print("all_predictions_map:", all_predictions_map)
print("vol:", vol)
Upvotes: 0
Views: 18