在shell脚本中通过终端使用install.packages()来自动选择CRAN镜像而不必停止代码

时间:2018-06-15 07:26:25

标签: r linux database putty

我在Linux shell脚本中运行R,我需要代码自行运行。目前我必须在这里运行install.packages(" RJDBC")并且它不停地暂停代码以询问CRAN镜像(在我的情况下,我需要它为51)。

换句话说,我运行下面的代码,我需要它来避免问我CRAN镜像是什么,我需要在不停止代码的情况下自动选择它。 (>之后的所有内容都是我在代码停止之前运行的),其余的都输出。

> #Libraries and Packages--------------
> install.packages("RJDBC") #Selection: 51 (Spain (Madrid))

[1] Installing package into ‘/usr/lib64/R/library’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
Secure CRAN mirrors

 1: 0-Cloud [https]                   2: Algeria [https]
 3: Australia (Canberra) [https]      4: Australia (Melbourne 1) [https]
 5: Australia (Melbourne 2) [https]   6: Australia (Perth) [https]
 7: Austria [https]                   8: Belgium (Ghent) [https]
 9: Brazil (PR) [https]              10: Brazil (RJ) [https]
11: Brazil (SP 1) [https]            12: Brazil (SP 2) [https]
13: Bulgaria [https]                 14: Chile 1 [https]
15: Chile 2 [https]                  16: China (Guangzhou) [https]
17: China (Lanzhou) [https]          18: China (Shanghai 1) [https]
19: China (Shanghai 2) [https]       20: Colombia (Cali) [https]
21: Czech Republic [https]           22: Denmark [https]
23: East Asia [https]                24: Ecuador (Cuenca) [https]
25: Ecuador (Quito) [https]          26: Estonia [https]
27: France (Lyon 1) [https]          28: France (Lyon 2) [https]
29: France (Marseille) [https]       30: France (Montpellier) [https]
31: France (Paris 2) [https]         32: Germany (Erlangen) [https]
33: Germany (Göttingen) [https]      34: Germany (Münster) [https]
35: Greece [https]                   36: Iceland [https]
37: India [https]                    38: Indonesia (Jakarta) [https]
39: Ireland [https]                  40: Italy (Padua) [https]
41: Japan (Tokyo) [https]            42: Japan (Yonezawa) [https]
43: Korea (Seoul 1) [https]          44: Korea (Ulsan) [https]
45: Malaysia [https]                 46: Mexico (Mexico City) [https]
47: Norway [https]                   48: Philippines [https]
49: Serbia [https]                   50: Spain (A Coruña) [https]
51: Spain (Madrid) [https]           52: Sweden [https]
53: Switzerland [https]              54: Turkey (Denizli) [https]
55: Turkey (Mersin) [https]          56: UK (Bristol) [https]
57: UK (Cambridge) [https]           58: UK (London 1) [https]
59: USA (CA 1) [https]               60: USA (IA) [https]
61: USA (KS) [https]                 62: USA (MI 1) [https]
63: USA (NY) [https]                 64: USA (OR) [https]
65: USA (TN) [https]                 66: USA (TX 1) [https]
67: Vietnam [https]                  68: (other mirrors)


Selection:

0 个答案:

没有答案