R:无法在MacOsX上更新软件包

时间:2014-01-06 22:06:11

标签: r macos

当我尝试在Mac OS X上更新R个软件包时(作为具有管理员权限的普通用户,即/Library/Frameworks/R.framework/Versions/3.0/Resources对我来说可写),我明白了:

> update.packages(instlib = .libPaths()[1], checkBuilt=TRUE, ask=FALSE)
Warning: package 'foreign' in library '/Library/Frameworks/R.framework/Versions/3.0/Resources/library' will not be updated
Warning: package 'lattice' in library '/Library/Frameworks/R.framework/Versions/3.0/Resources/library' will not be updated
Warning: package 'Matrix' in library '/Library/Frameworks/R.framework/Versions/3.0/Resources/library' will not be updated
Warning: package 'mgcv' in library '/Library/Frameworks/R.framework/Versions/3.0/Resources/library' will not be updated
Warning: package 'plotrix' in library '/Library/Frameworks/R.framework/Versions/3.0/Resources/library' will not be updated
trying URL 'http://lib.stat.cmu.edu/R/CRAN/bin/macosx/contrib/3.0/Hmisc_3.13-0.tgz'
Content type 'application/x-gzip' length 1514975 bytes (1.4 Mb)
opened URL
==============================================
downloaded 1.3 Mb

trying URL 'http://lib.stat.cmu.edu/R/CRAN/bin/macosx/contrib/3.0/Matrix_1.1-1.1.tgz'
Content type 'application/x-gzip' length 3450203 bytes (3.3 Mb)
opened URL
==================================================
downloaded 3.3 Mb

trying URL 'http://lib.stat.cmu.edu/R/CRAN/bin/macosx/contrib/3.0/nleqslv_2.1.tgz'
Content type 'application/x-gzip' length 89297 bytes (87 Kb)
opened URL
==================================================
downloaded 87 Kb

trying URL 'http://lib.stat.cmu.edu/R/CRAN/bin/macosx/contrib/3.0/plotrix_3.5-2.tgz'
Content type 'application/x-gzip' length 624295 bytes (609 Kb)
opened URL
========
downloaded 108 Kb

trying URL 'http://lib.stat.cmu.edu/R/CRAN/bin/macosx/contrib/3.0/nlme_3.1-113.tgz'
Content type 'application/x-gzip' length 2132159 bytes (2.0 Mb)
opened URL
==========
downloaded 457 Kb

trying URL 'http://lib.stat.cmu.edu/R/CRAN/bin/macosx/contrib/3.0/rpart_4.1-4.tgz'
Content type 'application/x-gzip' length 890223 bytes (869 Kb)
opened URL
==================================================
downloaded 869 Kb

Hmisc/help/Hmisc.rdb: (Empty error message)
tar: Error exit delayed from previous errors.
plotrix/R/plotrix.rdb: (Empty error message)
tar: Error exit delayed from previous errors.
Error: file ‘/var/tmp/RtmpY8MhsZ/downloaded_packages/plotrix_3.5-2.tgz’ is not an OS X binary package
In addition: Warning messages:
1: In download.file(url, destfile, method, mode = "wb", ...) :
  downloaded length 1402861 != reported length 1514975
Calls: update.packages -> install.packages -> .install.macbinary -> download.packages -> try -> tryCatch -> tryCatchList -> tryCatchOne -> doTryCatch -> download.file
2: In download.file(url, destfile, method, mode = "wb", ...) :
  downloaded length 111247 != reported length 624295
Calls: update.packages -> install.packages -> .install.macbinary -> download.packages -> try -> tryCatch -> tryCatchList -> tryCatchOne -> doTryCatch -> download.file
3: In download.file(url, destfile, method, mode = "wb", ...) :
  downloaded length 468901 != reported length 2132159
Calls: update.packages -> install.packages -> .install.macbinary -> download.packages -> try -> tryCatch -> tryCatchList -> tryCatchOne -> doTryCatch -> download.file
4: 'tar' returned non-zero exit code 1 
5: 'tar' returned non-zero exit code 1 
Execution halted

.tgz中的/var/tmp/RtmpY8MhsZ/downloaded_packages/个文件是有效的tar / gzip文件:

$ tar tvfz /var/tmp/RtmpY8MhsZ/downloaded_packages/Matrix_1.1-1.1.tgz 
drwxrwxr-x  0 root   admin       0 Jan  1 01:47 Matrix/
-rw-rw-r--  0 root   admin    2433 Jan  1 01:45 Matrix/Copyrights
drwxrwxr-x  0 root   admin       0 Jan  1 01:45 Matrix/data/
-rw-rw-r--  0 root   admin    1253 Jan  1 01:45 Matrix/DESCRIPTION
drwxrwxr-x  0 root   admin       0 Jan  1 01:47 Matrix/doc/
-rw-rw-r--  0 root   admin   72521 Jan  1 01:45 Matrix/Doxyfile
drwxrwxr-x  0 root   admin       0 Jan  1 01:45 Matrix/external/
drwxrwxr-x  0 root   admin       0 Jan  1 01:47 Matrix/help/
drwxrwxr-x  0 root   admin       0 Jan  1 01:47 Matrix/html/
drwxrwxr-x  0 root   admin       0 Jan  1 01:45 Matrix/include/
.....
我做错了吗?

1 个答案:

答案 0 :(得分:0)

作为recommended by @Bhas,解决方案是设置TAR环境变量:

TAR=/usr/bin/tar R CMD ...