在 R 中安装 quantmod

Installation of quantmod in R

我尝试安装 R quantmod

当我尝试时:

install.packages('quantmod')

我明白了:

Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
also installing the dependency ‘curl’

trying URL 'https://cloud.r-project.org/src/contrib/curl_3.1.tar.gz'
Content type 'application/x-gzip' length 366086 bytes (357 KB)
==================================================
downloaded 357 KB

trying URL 'https://cloud.r-project.org/src/contrib/quantmod_0.4-
12.tar.gz'
Content type 'application/x-gzip' length 140216 bytes (136 KB)
==================================================
downloaded 136 KB

* 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=
------------------------- 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 ‘/usr/local/lib/R/site-library/curl’
Warning in install.packages :
installation of package ‘curl’ had non-zero exit status
ERROR: dependency ‘curl’ is not available for package ‘quantmod’
* removing ‘/usr/local/lib/R/site-library/quantmod’
Warning in install.packages :
installation of package ‘quantmod’ had non-zero exit status

The downloaded source packages are in
‘/tmp/RtmpeR1Cmy/downloaded_packages’  Using PKG_LIBS=-lcurl

而且我不能 运行 这个库。

当我尝试时:

install.packages("quantmod", repos="https://github.com/joshuaulrich/quantmod")

我明白了:

Warning in install.packages :
package ‘quantmod’ is not available (for R version 3.4.4)

但是R版本3.4.4是最新的!!

有什么问题?

P.S。我的 R 版本 3.4.4 (2018-03-15) -- "Someone to Lean On"

Linux 薄荷 17.2 Rafaela

看来您需要为您的系统安装 curl。打开终端并 运行:

sudo apt-get update
sudo apt-get install curl libcurl4-openssl-dev libssl-dev

然后在 R 中再次尝试安装您的包:

install.packages('quantmod')

如果这不起作用,请编辑您的问题和post任何其他错误消息。