I would like to wrap a R function contained in a package princurve. With ipython I do it successfully with an ipython cell R magic:
%%R -i X -o s,lambda
fit1<-principal.curve(X)
s <- fit1$s
l <- fit1$lambda
but I want a function that I can import from a module like:
from mymodule import principal_curve
s, l = principal_curve(X)
I guess I have to use rpy directly, I am not sure how...