e1 <- new.env()
f1 <- a~b+c
environment(f1) <- e1
f2 <- ~-NULL+1
(l1 <- list_rhs.formula(f1))
(l2 <- list_rhs.formula(f2))
(l <- c(l1,l2))
# \dontshow{
stopifnot(identical(c(unclass(l)), alist(b, c, NULL, 1)))
stopifnot(identical(attr(l, "sign"), c(1,1,-1,1)))
stopifnot(identical(attr(l, "env"), rep(list(e1, globalenv()), each=2)))
# }
(l <- c(l2[1], l1[2], l1[1], l1[1], l2[2]))
# \dontshow{
stopifnot(identical(c(unclass(l)), alist(NULL, c, b, b, 1)))
stopifnot(identical(attr(l, "sign"), c(-1,1,1,1,1)))
stopifnot(identical(attr(l, "env"), list(globalenv(), e1, e1, e1, globalenv())))
# }
Run the code above in your browser using DataLab