我使用FormulaR 中的包来创建一个可以更新的条件公式。
(此处描述:如何更新条件公式?)
通过使用该Formula包,我的公式对象获得了两个类:"Formula"和"formula". 不幸的是,"Formula"该类不适FENmlm用于我用于计算模型的包。有没有办法删除"Formula"课程并保留"formula"课程?("Formula"该类仅用于更新模型)
# Conditional formula
fml1 <- Formula::Formula(Petal.Width ~ Petal.Length | Species)
# Update conditional formula
fml2 <- update(fml, . ~ . + Sepal.Length)
# Class
class(fml2)
# [1] "Formula" "formula"
# Calculation
FENmlm::femlm(fml2, data = iris)
# Error in FENmlm::femlm(fml2, data = iris) :
# The argument 'fml' must be a formula.
# Try to delete "Formula" attribute
attributes(fml2)[[1]][[1]] <- NULL
# Error in attributes(fml2)[[1]][[1]] <- NULL : replacement has length zero