[R] Determine IP address of gateway

Dr Eberhard Lisse nospam at lisse.NA
Tue Mar 14 16:25:26 CET 2017


I want code to run on my laptop depending on what WiFi I am connected to
(ie internally I access MySQL without password, externally with
password). Currently I look for the gateway and then branch accordingly.

Is there any way of doing

gateway = system("netstat -r -f inet -n|grep default|awk '{print $2}'",
intern = T)

within R other than running it as a system() call?

greetings, el

More information about the R-help mailing list