değil ama Eğer değişkenlerin sadece isimlerini almak isterseniz, Öte yandan
> attr(terms(f1),"term.labels")
[1] "x1" "x2" "1 | x3" "x4" "x1:x4"
> attr(terms(f2),"term.labels")
[1] "x1" "x2" "1 | x3 + (0 + x5 | x3)"
[4] "x4" "x1:x4"
formülü el deparse olabilir: o yararlı olabilir
reclapply <- function(x) {
if (is.name(x)) as.character(x)
else if (is.atomic(x)) NULL # ignore
else lapply(2:length(x), # omit function name - 1st element
function(i) reclapply(x[[i]]))
}
unique(unlist(reclapply(f1[[3]])))
## [1] "x1" "x2" "x3" "x4"
unique(unlist(reclapply(f2[[3]])))
## [1] "x1" "x2" "x3" "x5" "x4"
Bu size
all.vars(f1)
## [1] "y" "x1" "x2" "x3" "x4"
all.vars(f2)
## [1] "y" "x1" "x2" "x3" "x5" "x4"
hemen hemen aynı sonucu verir ama formül nesne üzerinde bazı ilginç bilgilere erişmek için nasıl bir ipucu sağlar.
Ve muhtemelen sadece sabit olmayan terimleri grep'leyebilirdiniz. –