There is a data frame need to fix the consistency of the two columns.
I used this code to get the uniques values of three columns (pop1_number, pop2_number, pop3_number):
y <- x %>% group_by(PROVINCE, DISTRICT, SUB_DISTRI, VILLAGE) %>% summarise(number_1 = unique(pop1_NUMBER), number_2 = unique(pop2_NUMBER), number_3 = unique(pop3_number))
I got this error
Error: Problem with `summarise()` input `number_2`. x Input `number_2` must be size 38 or 1, not 39. i An earlier column had size 38. i Input `number_2` is `unique(pop3_NUMBER)`. i The error occurred in group 5333: PROVINCE = 11, DISTRICT = 15, SUB_DISTRI = 10, VILLAGE = 37
Then got each of these three columns unique values by this code:
pop1_number <- x %>% group_by(PROVINCE, DISTRICT, SUB_DISTRI, VILLAGE) %>% summarise(number = unique(pop1_NUMBER)
The uniqueness of them was different. For pop1_number was 106444, for pop2_number was 106474, and for pop3_number was 106456.
I need to be the uniqueness of pop2_number and pop3_number 106444 too. This is what I am looking to fix.
Then I checked those rows of the data frame, some of the row values swapped. As you see on the screenshot, row 137 values must be in row 138 and row 138 must be in 137. I stuck here on how to fix it.
This is the data: