3
I have a set of data and would like to select only the smallest value among each primary key. Follow the example of my DF:
ORDEM <- c(1,5,2,3,1,10)
GUIA <- c('111','111','333','333','555','555')
COR <- c('AZUL','AMARELO','PRETO','LARANJA','ROSA','VERDE')
DADOS <- data.frame(ORDEM,GUIA,COR)
In this example, there are two records for each key (GUIA
). Therefore, I would like the result to appear only the lowest value from the column ORDEM
. The result I expect should be:
ORDEM <- c(1,2,1)
GUIA <- c('111','333','555')
COR <- c('AZUL','PRETO','ROSA')
DADOS_FINAL <- data.frame(ORDEM,GUIA,COR)