有没有办法在 R CLI 中使用为 Rstudio 设计的包?

Is there a way to use a package designed for Rstudio in R CLI?

有人写了一个包(我们称之为 'Thing'),它在很大程度上依赖于 Rstudio 来工作,包括需要 rstudioapi 库。它有一个身份验证例程 依赖于 rstudioapi::askForPassword("Enter your pw") 函数。

如果我 运行 安装例程,它会抛出这种错误:

> setup_thing()
Thanks for downloading Thing, the custom R package for things.
Loading required package: rstudioapi
Error: RStudio not running

我试图避免重写整个库;有没有办法在 RStudio 中安装和设置包,但使用其从 R CLI 配置的实例?

很遗憾,我认为答案是否定的。但可能有解决方法。你调查过cronR吗? https://cran.r-project.org/web/packages/cronR/README.html

您可以在 Rstudio 本身内安排作业。