reduce repeated code by using service functions for communications with R and zmq