gpt4 book ai didi

r - 如何从 biglm 对象中提取公式?

转载 作者:行者123 更新时间:2023-12-02 21:35:39 24 4
gpt4 key购买 nike

如何从biglm对象中提取公式?我已经尝试过函数 as.formula(),但它没有返回我期望的结果。示例:

m1 = lm(Fertility ~ Agriculture + Examination + Education + Catholic + Infant.Mortality, data=swiss)
as.formula(m1) # returns only the formula expression (that's what I want!)
# returns: Fertility ~ Agriculture + Examination + Education + Catholic + Infant.Mortality

library(biglm)
m2 = biglm(Fertility ~ Agriculture + Examination + Education + Catholic + Infant.Mortality, data=swiss)
as.formula(m2) # returns many things, but I want only the formula expression

最佳答案

您可以使用术语公式:

formula(terms(m2))

Fertility ~ Agriculture + Examination + Education + Catholic +
Infant.Mortality

关于r - 如何从 biglm 对象中提取公式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21438928/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com