Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set R to show console prompt on update.packages()?

Tags:

linux

r

When I start R in the console of my machine (R version 4.3.1 on Ubuntu 22.04.3 LTS) and run update.packages(), a popup prompts me to select a CRAN mirror.

enter image description here

Conversely, when I ssh in our server (R version 4.3.1 on AlmaLinux 9.2), I get the console prompt which I like much better.

> update.packages(ask=FALSE)
--- Please select a CRAN mirror for use in this session ---
Secure CRAN mirrors 

 1: 0-Cloud [https]
 2: Australia (Canberra) [https]
 3: Australia (Melbourne 1) [https]
 ...
75: United Arab Emirates [https]
76: Uruguay [https]
77: (other mirrors)

Selection: 

How can I set R on my machine to display the console prompt? Note that I do not want to set a default server.

like image 284
jay.sf Avatar asked Oct 25 '25 05:10

jay.sf


1 Answers

This is controlled by the menu.graphics option.

menu.graphics:
Logical: should graphical menus be used if available?. Defaults to TRUE. Currently applies to select.list, chooseCRANmirror, setRepositories and to select from multiple (text) help files in help.

options(menu.graphics = FALSE)

update.packages()

--- Please select a CRAN mirror for use in this session ---
Secure CRAN mirrors

 1: 0-Cloud [https]
 2: Australia (Canberra) [https]
 3: Australia (Melbourne 1) [https]
 ...
75: United Arab Emirates [https]
76: Uruguay [https]
77: (other mirrors)

To permanently default to text menus for the above functions, edit it into your .Rprofile file.

like image 195
Ritchie Sacramento Avatar answered Oct 26 '25 18:10

Ritchie Sacramento



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!