【问题标题】:Calling R function with se.fit parameter with rpy2 from Python从 Python 中使用 rpy2 调用带有 se.fit 参数的 R 函数
【发布时间】:2023-11-02 21:57:02
【问题描述】:

我需要调用 R 函数 predict(fit_hs, type="quantile", se.fit=True, p=0.5),其中 predict 指的是库生存中的 survreg

它给出了一个关于 se.fit 参数的错误,说它是一个不能使用的关键字。

您能帮忙找到一种从 Python 调用此 R 函数的方法吗?

【问题讨论】:

    标签: python r prediction rpy2


    【解决方案1】:

    在 Python 中不能使用“.”作为关键字的一部分,替换“.”使用“_”,所以“se_fit”应该可以工作。

    【讨论】: