Here is one way with dplyr . I'm not sure if ATRSLBL is a symbol or factor. My guess is that this is a factor. First, I converted the ATRSLBL character to a character. Then I replaced the duplicated Red and Blue with "" . I also created a group variable using cumsum() in the first part of mutate() . Using a group variable, I grouped the data and applied replace() to CENTRE . Here I say R, if the line number of each group is not 1, replace any character with "" . Therefore, you save the information in the first line of each group. Then you ungroup the data and split the group variable with select() . Hope this helps you.
library(dplyr) mutate(mydf, ATRSLBL = replace(as.character(ATRSLBL), which(duplicated(ATRSLBL) == TRUE), ""), group = cumsum(c(T, abs(diff(CENTRE)) > 1))) %>% group_by(group) %>% mutate(CENTRE = replace(CENTRE, which(row_number(CENTRE) != 1), "")) %>% ungroup %>% select(-group)
DATA
mydf <- structure(list(ATRSLBL = structure(c(2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L), .Label = c("Blue", "Red"), class = "factor"), POPUL = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = "PPS", class = "factor"), CENTRE = c(37201L, 37201L, 37201L, 38201L, 37201L, 38201L, 38201L, 38201L), BAGE = c(75L, 71L, 73L, 66L, 78L, 71L, 71L, 64L), BAGEC1 = c(3L, 2L, 2L, 2L, 3L, 2L, 2L, 1L), SEX = c(1L, 2L, 1L, 2L, 2L, 2L, 1L, 2L)), .Names = c("ATRSLBL", "POPUL", "CENTRE", "BAGE", "BAGEC1", "SEX"), class = "data.frame", row.names = c(NA, -8L))