Gsync Indicator Function In R