【问题标题】:Retain comments inside R expression在 R 表达式中保留注释
【发布时间】:2020-10-09 15:47:27
【问题描述】:
my_expr <- expr({
  # this is a comment
  this_is_code
})
my_expr

返回:

{
  this_is_code
}

但我希望它返回:

{
  # this is a comment
  this_is_code
}

是否可以使用 rlang 保留评论?

【问题讨论】:

    标签: r rlang


    【解决方案1】:

    评论已被保留,只是不会打印到控制台。查看attr(my_expr, "wholeSrcref")

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-26
      • 2016-10-25
      相关资源
      最近更新 更多