Typically generated by list_rhs.formula(), it contains, in
addition to a list of call() or similar objects, attributes
"sign" and "env", containing, respectively a vector of
signs that the terms had in the original formula and a list of
environments of the formula from which the term has been
extracted. Indexing and concatenation methods preserve these.
term_list(x, sign = +1, env = NULL)
as.term_list(x, ...)
# S3 method for class 'term_list'
as.term_list(x, ...)
# Default S3 method
as.term_list(x, sign = +1, env = NULL, ...)
# S3 method for class 'term_list'
c(x, ...)
# S3 method for class 'term_list'
x[i, ...]
# S3 method for class 'term_list'
print(x, ...)
e1 <- new.env()
f1 <- a~b+c
environment(f1) <- e1
f2 <- ~-NULL+1
(l1 <- list_rhs.formula(f1))
#> Term List:
#> + b <environment: 0x558aa0731e78>
#> + c <environment: 0x558aa0731e78>
(l2 <- list_rhs.formula(f2))
#> Term List:
#> - NULL <environment: 0x558aa071e5b0>
#> + 1 <environment: 0x558aa071e5b0>
(l <- c(l1,l2))
#> Term List:
#> + b <environment: 0x558aa0731e78>
#> + c <environment: 0x558aa0731e78>
#> - NULL <environment: 0x558aa071e5b0>
#> + 1 <environment: 0x558aa071e5b0>
#> Error: identical(attr(l, "env"), rep(list(e1, globalenv()), each = 2)) is not TRUE
(l <- c(l2[1], l1[2], l1[1], l1[1], l2[2]))
#> Term List:
#> - NULL <environment: 0x558aa071e5b0>
#> + c <environment: 0x558aa0731e78>
#> + b <environment: 0x558aa0731e78>
#> + b <environment: 0x558aa0731e78>
#> + 1 <environment: 0x558aa071e5b0>
#> Error: identical(attr(l, "env"), list(globalenv(), e1, e1, e1, globalenv())) is not TRUE