我们使用以下代码段创建R包
setwd("C:/Users/myname/Desktop/TestPackage")
getwd()
require(stats)
add<-function(x,y)x+y
package.skeleton(list=c("add"),name="addpkg")
使用以下命令在cmd中构建此程序包
C:Users\myname\Desktop\TestPackage> R CMD build addpkg
我收到以下错误
&#34; R&#34;不被认为是内部或外部命令, 可操作程序或批处理文件。
NOTE
System Directory for R :> C:\Program Files\R\R-3.0.2
System Directory for R Studio:>C:\Program Files\RStudio
System Directory for R tools :>C:\Rtools
操作系统:Windows -8
环境变量中的路径:
C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x64;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files(x86)\R-3.0.2\bin\;C:\Program Files(x86)\R-3.0.2\bin\x64\;C:\Program Files (x86)\RStudio\bin\;C:\Program Files (x86)\RStudio\bin\x64\;C:\Rtools\bin;C:\Rtools\gcc-4.6.3\bin;C:\Rtools\gcc-4.6.3\bin32;C:\Rtools\gcc-4.6.3\bin64;
答案 0 :(得分:0)
请使用,C:\ Program Files \ R-3.0.2 而不是C:\ Program Files(x86)\ R-3.0.2