首页 > 解决方案 > 警告:`pkgname` 既不是文件也不是目录,跳过

问题描述

我尝试执行代码 R CMD check pkgname ,但其结果是

C:\Users\username>R CMD check pkgname
Warning: 'pkgname' is neither a file nor directory, skipping

我也执行了以下,但它并不顺利。

C:\Users\username>R CMD Rd2pdf pkgname
Converting Rd files to LaTeX ...
  pkgname
Warning in file(con, "r") :
  cannot open file 'pkgname': No such file or directory
Error in file(con, "r") : cannot open the connection

------------我的包名是贝叶斯AAAA--------------------------------

C:\Users\username>R CMD check BayesianAAAA
Warning: 'BayesianAAAA' is neither a file nor directory, skipping


C:\Users\username>R CMD Rd2pdf BayesianAAAA
Converting Rd files to LaTeX ...
  BayesianAAAA
Warning in file(con, "r") :
  cannot open file 'BayesianAAAA': No such file or directory
Error in file(con, "r") : cannot open the connection

------------在我的包目录上打开命令提示符--------------------------------

通过 [shift] + 右键单击​​,我在我的包上打开命令提示符并运行上面的代码。但是结果与上一个相同。

C:\Users\usename\Desktop\BayesianAAAA>R CMD Rd2pdf BayesianAAAA
Converting Rd files to LaTeX ...
  BayesianAAAA
Warning in file(con, "r") :
  cannot open file 'BayesianAAAA': No such file or directory
Error in file(con, "r") : cannot open the connection

--------- 通过我的 pkg 目录的路径编写,代码运行良好!伟大的 !!------------------

C:\Users\usename>R CMD Rd2pdf C:\Users\usename\Desktop\BayesianFROC
Hmm ... looks like a package
Converting Rd files to LaTeX ...
Creating pdf output from LaTeX ...
sed: not found
sed: not found
kpsewhich: not found
cat: not found
Warning: running command '"C:\w32tex\bin\texi2dvi.exe"  --pdf "Rd2.tex" ' had status 1
Saving output to 'BayesianAAAA.pdf' ...
Done
'BayesianAAAA.pdf' not found
Warning: running command 'open BayesianAAAA.pdf' had status 34

标签: rcommand-prompt

解决方案


to 的参数R CMD check必须是.tar.gz文件名或目录名。由于您当前的工作目录是C:\Users\usename\Desktop\BayesianAAAA要使用的目录名称.,因此不是BayesianAAAA. 如果你想

R CMD check BayesianAAAA

要工作,您的工作目录必须是C:\Users\usename\Desktop. 或者,您应该能够使用

R CMD check C:/Users/usename/Desktop/BayesianAAA

但是如果usename里面有空格,如果没有在路径周围进行某种引用,这可能是行不通的。

顺便说一句,如果您使用 RStudio,这会容易得多:您将包设置为项目,然后只需单击选项CheckBuild


推荐阅读