I have data frame A comprising COLLECTIBILITY and CIFNO. COLLECTIBILITY can range from 1 to 5 for the same CIFNO. I want to group by CIFNO, replacing all COLLECTIBILITY by the maximum value for the CIFNO.
COLLECTIBILITY CIFNO
5 D014418
5 D014418
5 D014418
5 D014418
I use B <- A %>% group_by(CIFNO) %>% summarise(KOLEKTIBILITAS = max(KOLEKTIBILITAS)). Data frame B looks as follows:
CIFNO KOLEKTIBILITAS
1 "" 1
2 "0000026" 2
3 "0000094" 2
4 "1000109" 2
5 "1000133" 2
The format of CIFNO gets changed from an alphabet followed by 6 digits to 7 digits.
How can I keep the data format of CIFNO from changing?