Translate C code of labels2R into R code.