Reprex 不参考 RStudio Cloud 上的当前选择

Reprex does not consult the current selection on RStudio Cloud

我想在 RStudio Cloud 上使用 reprex

reprex 手册说:

When the clipboard is structurally unavailable, e.g., on RStudio Server or RStudio Cloud, reprex() consults the current selection instead of the clipboard

但是,当我 select 我在 RStudio Cloud 上的脚本中编写代码并在控制台中键入 reprex::reprex() 时,我收到以下消息:

No user-supplied code found … so we’ve made some up. You’re welcome!

``` r
sprintf("Happy %s!", weekdays(Sys.Date()))
#> [1] "Happy Thursday!"
```

<sup>Created on 2021-03-18 by the [reprex package](https://reprex.tidyverse.org) (v1.0.0)</sup>

更新1: 如果我将代码复制到剪贴板 and/or select 脚本中,我会在控制台中收到以下错误:

> reprex::reprex()

! No input provided and clipboard is not available.

jennybc 友善地回答了这个问题:https://github.com/tidyverse/reprex/issues/369#issuecomment-803229938

This is a feature of dev reprex, so it is not yet on CRAN. Therefore, I suspect this is a version issue. (The pkgdown site reflects dev capabilities.)

I will release these features to CRAN reprex soon.