向R中的调用对象添加元素

问题描述 投票:2回答:2

我想知道如何将& 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

r regex function character lm
2个回答
2
投票

无需使用bquote仅在语言级别转换为文本即可完成此操作]

bquote(.(s) & weeks == 1)
## type == 1 & ESL == 1 & prof == T & weeks == 1
© www.soinside.com 2019 - 2024. All rights reserved.