. Advertisement .
..3..
. Advertisement .
..4..
Here is the program I run:
install.packages("weatherData")
library(weatherData)
istanbul <- getWeatherForDate("Istanbul",
start_date = Sys.Date() - 41,
end_date = Sys.Date())
After I run, it returns an error:
Quitting from lines 3-31 (ist_weather.spin.Rmd)
Error in contrib.url(repos, type) :
trying to use CRAN without setting a mirror
Calls: <Anonymous> ... eval -> eval -> install.packages -> grep -> contrib.url
Execution halted
Does anyone have any suggestions for the problem below: trying to use cran without setting a mirror in the r. How to correct it?
The cause: The cause of this error perhaps due to forget about setting up CRAN for each R session.
The solution: To solve this error, you might use a mirror as a install.packages argument:
Beside, default CRAN mirror can be set up in your .Rprofile.
Set the CRAN repository within your R. Launch R or RStudio. Run the following codes in R terminal.
The above code defines CRAN repository for R. In the next package installation, there is no need to redefine it again.
Another alternative is to run
install.packages("weatherData", repos="http://cran.us.r-project.org")
. The second solution does not work and the repository must be set. You will need to pass this parameter with every package installation.