R CMD 氧气无法识别

发布于 2024-10-06 08:11:38 字数 300 浏览 4 评论 0原文

我刚刚尝试了 Roxygen 套餐。在 R 中,我可以运行 Roxygen Vignette 中的示例。但在命令行中,R CMD roxygen 未被识别为有效命令。当我运行 R CMD --help 时,我可以看到所有 INSTALL、check、...sweave...、config... 命令项,但看不到 roxygen。谁能帮我解决这个问题吗?除了 install.packages("roxygen") 之外,还需要其他安装步骤吗?我使用带有 R 2.12.0 的 Windows 32 和工作 Rtools 环境。谢谢。

I just tried out Roxygen package. Within R, I can run through the example in the Roxygen Vignette. But In command line, R CMD roxygen is not recognized as a valid command. When I run R CMD --help, I can see all INSTALL, check, ...sweave..., config... command items but not roxygen. can anyone help me out of this? is there addtional installation steps required other than install.packages("roxygen")? I use windows 32 with R 2.12.0 and working Rtools environments. Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

我不在是我 2024-10-13 08:11:38

如果我记得的话,您必须从源代码安装软件包,以便它们能够为 R CMD 提供其他命令。这是因为安装新的 R CMD 命令有点麻烦——它需要劫持配置脚本或 Makefile 并将文件复制到 R bin 文件夹。从二进制文件安装包只是解压存档,configuremake 永远不会运行。

因此,请尝试 install.packages('roxygen', type='source')。在 Windows 上,您需要安装 RTools 才能正常工作。

If I recall, you have to install packages from source in order for them to be able to provide additional commands for R CMD. This is because installing new R CMD commands is a bit of a hack---it requires hijacking the configure script or Makefile and having them copy files to the R bin folder. Installing a package from binary simply unpacks an archive, configure and make are never run.

So try install.packages('roxygen', type='source'). On Windows you will need to install the RTools before this will work.

吻泪 2024-10-13 08:11:38

前几天我刚刚遇到了这个。我以管理员身份安装并修复了它。只需以管理员身份运行 R,然后像平常一样执行 install.packages,然后重新启动 R,因为您并不真正想以管理员身份运行它。

I just ran into this the other day. I installed as administrator and that fixed it. Just run R as Administrator then do install.packages as normal, then restart R since you don't really want to run it as administrator.

蘑菇王子 2024-10-13 08:11:38

我发现这是一种在 Windows 中通过命令行 (DOS) 使用 roxygen2 非常有用的解决方法。大部分材料均借自此处

创建包含以下内容的文件 roxy.R:(

library(methods)
library(utils)
require(roxygen2)
roxygenize("myPackage")

或者您在 roxygen 中使用的任何参数)。

然后创建批处理文件 f.bat ,其内容为:

Rscript roxy.R

然后从命令行运行 f

> f

注意:

确保 Rscript.exe 在您的路径中。它通常位于 c:\r:\bin\ 之类的位置

(要在 Windows 中编辑路径,请右键单击“我的电脑”,然后选择“属性”,然后选择“高级系统设置”(在左侧菜单中) )然后“高级”选项卡、“环境变量”按钮、“系统变量”、“路径”。)

This is a workaround that I have found to be useful working with roxygen2 from the command line (DOS) in Windows. Much of the material is borrowed from here.

Create file roxy.R with contents:

library(methods)
library(utils)
require(roxygen2)
roxygenize("myPackage")

(Or whatever arguments you're using with roxygen).

Then create batch file f.bat with contents:

Rscript roxy.R

Then run f from the command line:

> f

Notes:

Make sure Rscript.exe is in your path. It's usually found somewhere like c:\r:\bin\

(To edit the path in Windows, right click 'My Computer', then select 'Properties' then 'Advanced system settings' (on left menu) then 'Advanced' tab, 'Environment Variables' button, 'System variables', 'Path'.)

放血 2024-10-13 08:11:38

我在windows上测试过。 R CMD %R_home%\bin\roxygen.sh 有效。
R CMD roxygen.shR CMD roxygen都不能在DOS命令下工作。虽然 .sh 已与 sh.exe 关联,并且 %R_home%\bin\ 位于系统路径上。
与使用 R CMD INSTALLinstall.packages(type='source') 按源安装相同。

I tested on windows. R CMD %R_home%\bin\roxygen.sh works.
but neither R CMD roxygen.sh nor R CMD roxygen works under DOS command. Although .sh has been associated to sh.exe and %R_home%\bin\ is on system path.
Same for installing by source with R CMD INSTALL or install.packages(type='source').

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文