将元素添加到 R 中的调用对象
Adding an element to a call object in R
我想知道如何将 & weeks == 1
添加到下面 s
的末尾?
s <- substitute(type == 1 & ESL == 1 & prof == T) # A `call` object
# Tried the following to add "& weeks == 1" to end of `s` without success:
c(s, "& weeks == 1")
希望输出如下调用对象:
type == 1 & ESL == 1 & prof == T & weeks == 1
使用 bquote
:
无需仅在语言级别转换为文本即可完成此操作
bquote(.(s) & weeks == 1)
## type == 1 & ESL == 1 & prof == T & weeks == 1
我想知道如何将 & weeks == 1
添加到下面 s
的末尾?
s <- substitute(type == 1 & ESL == 1 & prof == T) # A `call` object
# Tried the following to add "& weeks == 1" to end of `s` without success:
c(s, "& weeks == 1")
希望输出如下调用对象:
type == 1 & ESL == 1 & prof == T & weeks == 1
使用 bquote
:
bquote(.(s) & weeks == 1)
## type == 1 & ESL == 1 & prof == T & weeks == 1