How to override variable search in R?

Is it possible to override how R searches for variables?

In particular, I have 2 R processes: client and server. I want to make the following extension for the server process variable visibility rules: if xit cannot be found in any parent environment, request the client process instead for x:

# i.e. when (in the server process) I write
x

# I actually mean:
if (exists("x")) {
    x
} else {
    getFromClient("x", port = 1234L)
}

Is it possible?

Background

I am doing a small IPC at the moment when client processes can issue commands to the server process to execute. However, commands inevitably work with data (which are located with the client), and currently I have to manually hard-code each variable that should be exported from the client to the server.

, , .

.

+4
1

, .

, , , , undefined.

, x$foo, x - , $foo? ? ?

, , , , - .

, - .

+1

Source: https://habr.com/ru/post/1529495/


All Articles