getSymbols() from quantmod in R doesn't work - r

I tried running getSymbols() from the famous library quantmod in R, but it didn't work. So I want to ask how to solve this problem.
The codes that I tried was the following :
library(quantmod)
getSymbols("AAPL")
Error in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m, :
cannot open URL 'http://ichart.finance.yahoo.com/table.csv?s=AAPL&a=0&b=01&c=2007&d=4&e=30&f=2019&g=d&q=q&y=0&z=AAPL&x=.csv'
In addition: Warning message:
In download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m, :
InternetOpenUrl failed: '서버 이름이나 주소를 확인할 수 없습니다.'
getSymbols("AAPL", src="google")
Error in download.file(paste(google.URL, "q=", Symbols.name, "&startdate=", :
cannot open URL 'http://finance.google.com/finance/historical?q=AAPL&startdate=Jan+01,+2007&enddate=May+30,+2019&output=csv'
In addition: Warning message:
In download.file(paste(google.URL, "q=", Symbols.name, "&startdate=", :
cannot open URL 'http://finance.google.com/finance/historical?q=AAPL&startdate=Jan+01,+2007&enddate=May+30,+2019&output=csv': HTTP status was '403 Forbidden'
I have ever run this function on the same desktop(OS : Windows 8.1K, x64).
Thank you for telling me about the right lastest version, so I tried upgrading the package like the below, but to fail.
install.packages("quantmod")
It answered that it still calls v0.4-7.
Installing package into ‘C:/Users/fya/Documents/R/win-library/3.3’
(as ‘lib’ is unspecified)
trying URL 'https://mran.revolutionanalytics.com/snapshot/2016-11-01/bin/windows/contrib/3.3/quantmod_0.4-7.zip'
Content type 'application/zip' length 472947 bytes (461 KB)
downloaded 461 KB
package ‘quantmod’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\***\AppData\Local\Temp\RtmpozsYvx\downloaded_packages
Is there more effective way for solving this problem?
I referred to another stackoverflow page about upgrading packages in R :
https://stackoverflow.com/questions/21461649/how-to-update-a-package-in-r

The latest version of quantmod on CRAN is 0.4-14, so you need to upgrade. Also note that Google Finance no longer provides any data.
You're using MRAN and R-3.3.x. MRAN may have quantmod_0.4-14, but they apparently do not for older R versions. And CRAN only provides Windows binaries for the latest minor version of R (currently 3.6.x).
You can install the latest quantmod from CRAN on R-3.3.x, but you will have to do some of the steps manually. Download quantmod_0.4-14 from CRAN then call:
install.packages("quantmod_0.4-14.tar.gz", repos = NULL, type = "source")
I think that should work. Comment if you still have issues.

Related

Get error on installing colorspace_2.0-3 from R Studio with R.4.2.1

I have an error when I try to install colorspace (it was ok few days ago) :
install.packages("colorspace")
I have this messsage :
Warning in install.packages : downloaded length 2594858 != reported length 2627626
Warning in install.packages : URL 'http://cran.rstudio.com/bin/windows/contrib/4.2/colorspace_2.0-3.zip': status was 'Transferred a partial file'
Error in download.file(url, destfile, method, mode = "wb", ...) : download from 'http://cran.rstudio.com/bin/windows/contrib/4.2/colorspace_2.0-3.zip' failed
Warning in install.packages : le téléchargement du package ‘colorspace’ a échoué
I have already tried the solution proposed here : 28887446
I notice I can't download the package source "colorspace_2.0-3.tar.gz" from
https://cran.r-project.org/web/packages/colorspace/index.html or from http://cran.rstudio.com/bin/windows/contrib/4.2/. I suppose this is not normal, correct ?
In addition, I can't install Rtools on my professional computer.
Thank you for your help !
Screenshot :
download_error_chrome

Can't Install Package "sp"

I am new to geospatial analysis in R as all of my previous experience is in bioinformatics work. I am attempting to install some of the basic geospatial packages, but am having some issues, specifically revolving around installing the package "sp". When attempt I install.packages("sp") I get the following result:
install.packages("sp")
Installing package into ‘C:/Users/LMetz/Documents/R/win-library/4.1’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/sp_1.4-7.zip'
Warning in install.packages :
cannot open URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/sp_1.4-7.zip': HTTP status was '404 Not Found'
Error in download.file(url, destfile, method, mode = "wb", ...) :
cannot open URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/sp_1.4-7.zip'
Warning in install.packages :
download of package ‘sp’ failed
It appears that the URL install.packages is trying to access to download the package no longer exists. Does anyone know what I need to do to fix this? Thanks.

Unable to install R package

When I tried to install the package coxphf, the following error appeared.
Please let me know how to solve this:
install.packages("coxphf")
> Installing package into ‘C:/Users/User/R/win-library/3.4’
> (as ‘lib’ is unspecified)
> trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/coxphf_1.12.zip'
Warning in install.packages :
cannot open URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/coxphf_1.12.zip': HTTP status was '404 Not Found'
Error in download.file(url, destfile, method, mode = "wb", ...) :
cannot open URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/coxphf_1.12.zip'
Warning in install.packages :
download of package ‘coxphf’ failed
Looks like the package isn't available on CRAN at that address.
After digging around, I found the package here: https://cran.rstudio.com/bin/windows/contrib/3.4/coxphf_1.13.zip
Download it and follow instructions here:
http://stat.columbia.edu/~gelman/bugsR/alternate_install.html
It's not expected behavior though, I'm not sure what's causing it, but this workaround will do fine for now

Unable to install Rcpp package when loading forecast

When I try to load the forecast package it trows me the error that there is not Rcpp package which it depends on
by trying to install Rcpp package manually i get the following error
install.packages("Rcpp")
Installing package into ‘C:/Users/~~~’
(as ‘lib’ is unspecified)
There is a binary version available but the source version is later:
binary source needs_compilation
Rcpp 0.12.10 0.12.11 TRUE
Binaries will be installed
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/Rcpp_0.12.10.zip'
Warning in install.packages :
cannot open URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/Rcpp_0.12.10.zip': HTTP status was '404 Not Found'
Error in download.file(url, destfile, method, mode = "wb", ...) :
cannot open URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/Rcpp_0.12.10.zip'
Warning in install.packages :
download of package ‘Rcpp’ failed
This is a likely duplicate. You misunderstand the meaning of There is a binary version available but the source version is later..
Install from source, use a different mirror, or just wait.
The 0.12.11 binary is clearly there in Vienna and at the 0-cloud mirrors.

Warning in install.packages : cannot open: HTTP status was '404 Not Found'

I have attempted to download R package memoise:
install.packages("memoise")
However, I have recevied the following error message:
trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.0/memoise_0.1.zip'
Warning in install.packages :
cannot open: HTTP status was '404 Not Found'
Error in download.file(url, destfile, method, mode = "wb", ...) :
cannot open URL 'http://cran.rstudio.com/bin/windows/contrib/3.0/memoise_0.1.zip'
Warning in install.packages :
download of package ‘memoise’ failed`
I am connected to the internet and the WWW. In addition, I am connected to a work network. I am using the RStudio IDE.
Does anyone have any advice for how I troubleshoot this problem?
as I can see there is no "memoise_0.1.zip" at http://cran.rstudio.com/bin/windows/contrib/3.0/ . However, there is the "memoise_0.2.1.zip" file.
What version of RStudio IDE are you using? Do you have memoise already installed? Maybe you should try to update the memoise package.
I returned to this problem this morning. I restarted RStudio and tried the following again:
install.packages("memoise")
This time I received the following response:
Installing package into ‘\\oxdc/userdata/jolyon.faria/Documents/R/win-library/3.0’
(as ‘lib’ is unspecified)
trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.0/memoise_0.2.1.zip'
Content type 'application/zip' length 16813 bytes (16 Kb)
opened URL
downloaded 16 Kb
This time it (unexpectedly) 'found' the correct webpage so problem solved. Thanks for your help.

Resources