@garagecoder is right: when you want to manipulate image pixels directly instead of creating a pipeline, using the math parser could make things easier. In your case, I guess this should work :
$ gmic input.jpg -fill "R-(B+G)/2"
and probably better, if you want a 1-channel image instead as the result:
$ gmic input.jpg 100%,100%,1,1,"R#0-(B#0+G#0)/2"
G'MIC has been primarily designed to create pipelines of image processing operators, and I've quickly found that this was not always a practical way of thinking, for a custom-made pixelwise operator. So that's why I've started implementing the math parser a few years ago, and I can say that it reached a state where it is extremely powerful I personally use it more and more in my G'MIC commands !