counting in R updated