In file(file, "rt") : InternetOpenUrl failed


#1

Hi All,
I am new in this Forum:
I try to rerun a script I have used some weeks ago and worked .
The script imports stocks data. For any reason I get an error when I try use it:

> ###This script return matrix named"output" that its columns has assets and rows are theterms###
> stocks <- c(“AMZN”=1,“ETFC”=1,“INTU”=1,“MU”=1,“MU”=1,“CBS”=1,“UNH”=1,“APD”=1,“BLL”=1,“HAS”=1)
> returns <- getReturns(names(stocks), freq=“week”)
Error in file(file, “rt”) : cannot open the connection
In addition: Warning message:
In file(file, “rt”) :
_ InternetOpenUrl failed: ‘‏‏לא היתה אפשרות לזהות את שם השרת או את כתובתו’_
'
In addition -attaching the sript that import the required packages I use:
install.packages(“devtools”)
library(“tools”, lib.loc="~/R/R-3.3.1/library")
library(“devtools”, lib.loc="~/R/R-3.3.1/library")
library(“Matrix”, lib.loc="~/R/R-3.3.1/library")
library(“Rmosek”, lib.loc="~/R/R-3.3.1/library")
library(“stockPortfolio”, lib.loc="~/R/R-3.3.1/library")
library(“expm”, lib.loc="~/R/R-3.3.1/library")
library(zoo)
library(lattice)
library(reshape)

install.packages(‘ggplot2’)

install.packages(“devtools”, repos=“https://cran.rstudio.com/”)

install.packages(‘c:/gurobi751/win64/R/gurobi_7.5-1.zip’, repos=NULL)
library(gurobi)

Asking your assitance to handle the error.
Thanks in advanced.
Ishy.


#2

Not sure of the reason why it occurs, but I too had this issue with my Rscripts and from somewhere in the forums I was advised to run the below code before running the script which worked.

options(download.file.method="libcurl")


#3

It still fails-even after runing this script