R CMD 氧气无法识别
我刚刚尝试了 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果我记得的话,您必须从源代码安装软件包,以便它们能够为
R CMD
提供其他命令。这是因为安装新的 R CMD 命令有点麻烦——它需要劫持配置脚本或 Makefile 并将文件复制到 R bin 文件夹。从二进制文件安装包只是解压存档,configure
和make
永远不会运行。因此,请尝试
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 newR 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
andmake
are never run.So try
install.packages('roxygen', type='source')
. On Windows you will need to install the RTools before this will work.前几天我刚刚遇到了这个。我以管理员身份安装并修复了它。只需以管理员身份运行 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.
我发现这是一种在 Windows 中通过命令行 (DOS) 使用
roxygen2
非常有用的解决方法。大部分材料均借自此处 。创建包含以下内容的文件
roxy.R
:(或者您在
roxygen
中使用的任何参数)。然后创建批处理文件
f.bat
,其内容为:然后从命令行运行
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:(Or whatever arguments you're using with
roxygen
).Then create batch file
f.bat
with contents:Then run
f
from the command line:Notes:
Make sure
Rscript.exe
is in your path. It's usually found somewhere likec:\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'.)
我在windows上测试过。
R CMD %R_home%\bin\roxygen.sh
有效。但
R CMD roxygen.sh
和R CMD roxygen
都不能在DOS命令下工作。虽然.sh
已与sh.exe
关联,并且%R_home%\bin\
位于系统路径上。与使用
R CMD INSTALL
或install.packages(type='source')
按源安装相同。I tested on windows.
R CMD %R_home%\bin\roxygen.sh
works.but neither
R CMD roxygen.sh
norR CMD roxygen
works under DOS command. Although.sh
has been associated tosh.exe
and%R_home%\bin\
is on system path.Same for installing by source with
R CMD INSTALL
orinstall.packages(type='source')
.