R安装package报ERROR: a 'NAMESPACE' file is required

时间:2023-03-08 16:51:53

R安装package报错:

[root@Hadoop-NN-01 mysofts]# R CMD INSTALL trimcluster_0.1-1.tar.gz
* installing to library '/usr/local/lib64/R/library'
WARNING: omitting pointless dependence on 'R' without a version requirement
* installing *source* package 'trimcluster' ...
ERROR: a 'NAMESPACE' file is required
* removing '/usr/local/lib64/R/library/trimcluster'

解决方案:

#解压
tar -xzf trimcluster_0.1-1.tar.gz #写入NameSpace
cd trimcluster
echo 'exportPattern( "." )' > NAMESPACE
cd .. #打包
tar -zcf trimcluster.tar.gz trimcluster #再次安装
R CMD INSTALL trimcluster.tar.gz

安装成功!