保留 R 表达式中的注释

Retain comments inside R expression

my_expr <- expr({
  # this is a comment
  this_is_code
})
my_expr

returns:

{
  this_is_code
}

但我想 return:

{
  # this is a comment
  this_is_code
}

是否可以使用 rlang 保留注释?

评论已经保留,只是没有打印到控制台。查看 attr(my_expr, "wholeSrcref")