Plc Programming Create Function In R