无法下载{data.table}包

时间:2016-03-09 04:36:56

标签: r data.table install.packages

我最初使用以下方法从CRAN下载了data.table包:

install.packages()

它下载了1.9.4版本,在遇到一些速度障碍并通过这个网站后,我想我必须从github下载最新版本。为了做到这一点,我试图下载到" devtools"但我没有成功。以下是我得到的错误:

* installing *source* package ‘curl’ ...
** package ‘curl’ successfully unpacked and MD5 sums checked
Package libcurl was not found in the pkg-config search path.
Perhaps you should add the directory containing `libcurl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libcurl' found
Package libcurl was not found in the pkg-config search path.
Perhaps you should add the directory containing `libcurl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libcurl' found
Using PKG_CFLAGS=
Using PKG_LIBS=-lcurl
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because libcurl was not found. Try installing:
 * deb: libcurl4-openssl-dev (Debian, Ubuntu, etc)
 * rpm: libcurl-devel (Fedora, CentOS, RHEL)
 * csw: libcurl_dev (Solaris)
If libcurl is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a libcurl.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------
ERROR: configuration failed for package ‘curl’
* removing ‘/home/trader/R/x86_64-pc-linux-gnu-library/3.2/curl’
Warning in install.packages :
  installation of package ‘curl’ had non-zero exit status
* installing *source* package ‘RCurl’ ...
** package ‘RCurl’ successfully unpacked and MD5 sums checked
checking for curl-config... no
Cannot find curl-config
ERROR: configuration failed for package ‘RCurl’
* removing ‘/home/trader/R/x86_64-pc-linux-gnu-library/3.2/RCurl’
Warning in install.packages :
  installation of package ‘RCurl’ had non-zero exit status
ERROR: dependency ‘curl’ is not available for package ‘httr’
* removing ‘/home/trader/R/x86_64-pc-linux-gnu-library/3.2/httr’
Warning in install.packages :
  installation of package ‘httr’ had non-zero exit status
ERROR: dependency ‘curl’ is not available for package ‘rversions’
* removing ‘/home/trader/R/x86_64-pc-linux-gnu-library/3.2/rversions’
Warning in install.packages :
  installation of package ‘rversions’ had non-zero exit status
ERROR: dependencies ‘httr’, ‘RCurl’, ‘rversions’ are not available for package ‘devtools’
* removing ‘/home/trader/R/x86_64-pc-linux-gnu-library/3.2/devtools’
Warning in install.packages :
  installation of package ‘devtools’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpMtxhRg/downloaded_packages’

所以我尝试了另一种方法并从https://cran.r-project.org/web/packages/data.table/index.html下载了.tar.gz文件。

然后使用:

> install.packages("~/Downloads/data.table_1.9.6.tar.gz", repos = NULL, type = "source")

下载成功但尝试加载时出现以下错误:

> library("data.table", lib.loc="~/R/x86_64-pc-linux-gnu-library/3.2")
data.table 1.9.6  For help type ?data.table or https://github.com/Rdatatable/data.table/wiki
The fastest way to learn (by data.table authors): https://www.datacamp.com/courses/data-analysis-the-data-table-way

Attaching package: ‘data.table’

The following object is masked from ‘package:xts’:

    last

Error in fetch(key) : 
  lazy-load database '/home/trader/R/x86_64-pc-linux-gnu-library/3.2/data.table/help/data.table.rdb' is corrupt
In addition: Warning message:
In fetch(key) : internal error -3 in R_decompress1

我的会话信息如下:

> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu precise (12.04.5 LTS)

locale:
 [1] LC_CTYPE=en_IN.UTF-8       LC_NUMERIC=C               LC_TIME=en_IN.UTF-8        LC_COLLATE=en_IN.UTF-8     LC_MONETARY=en_IN.UTF-8    LC_MESSAGES=en_IN.UTF-8   
 [7] LC_PAPER=en_IN.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_IN.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] data.table_1.9.6    plyr_1.8.3          git2r_0.11.0        ISLR_1.0            bigtabulate_1.1.2   biglm_0.9-1         DBI_0.3.1           biganalytics_1.1.1 
 [9] bigmemory_4.4.6     BH_1.58.0-1         bigmemory.sri_0.1.3 highfrequency_0.4   xts_0.9-7           zoo_1.7-12         

loaded via a namespace (and not attached):
[1] Rcpp_0.12.0     lattice_0.20-33 chron_2.3-47    grid_3.2.2      magrittr_1.5    stringi_1.0-1   reshape2_1.4.1  tools_3.2.2     stringr_1.0.0 

我不确定我现在应该做什么。有人可以帮忙吗?

1 个答案:

答案 0 :(得分:4)

看起来安装已损坏。

  1. 关闭所有会话
  2. 在控制台中启动单个清理R会话(以排除任何IDE问题)
  3. 使用以下命令直接从github存储库安装开发版本:
  4. install.packages("data.table", repos = "https://Rdatatable.github.io/data.table")
    
    1. 安装完成后,您可以选择验证所有测试
    2. library(data.table)
      test.data.table()
      

      如果您要安装最新的CRAN版本,请跳过repos参数install.packages