【发布时间】:2018-10-10 17:56:00
【问题描述】:
使用 rlang,我想获得 quo(just_an_example) 的结果,同时键入 quo("just_an_example")。 这意味着我想获得
<quosure: global>
~just_an_example
但是当 quo() 中的表达式是字符串“just_an_example”时。任何帮助将不胜感激。
【问题讨论】:
标签: r string tidyverse evaluation
使用 rlang,我想获得 quo(just_an_example) 的结果,同时键入 quo("just_an_example")。 这意味着我想获得
<quosure: global>
~just_an_example
但是当 quo() 中的表达式是字符串“just_an_example”时。任何帮助将不胜感激。
【问题讨论】:
标签: r string tidyverse evaluation
但是我不确定解决方案,因为我无法完全理解这个问题,但即使您在 rlang::quo 函数中输入带引号的字符串,您似乎也希望获得相同的结果。我正在使用 rlang_0.2.0.9001 版本。
你可以试试这个:
library(rlang)
quo(!!as.symbol("just_an_example"))
或
quo(!!sym("just_an_example"))
输出:
> quo(!!sym("just_an_example"))
<quosure>
expr: ^just_an_example
env: global
【讨论】: