I write to ask for help on this:
I have a dataframe with 3 variables and I want to add the value taking into account the sequence and the product, it can be using the aggregate function and it is as follows.r
UNICOS <- aggregate(Secuencia ~ Producto, Atencion, function(x),
length(unique(x)) UNICOS <- UNICOS[order(-UNICOS$Secuencia), ]
UNICOS$Producto <- factor(UNICOS$Producto, levels=UNICOS$Producto, ordered = TRUE)
I have this code but as you can see this one takes into account 2 variables, it tells me the unique values according to the sequence, I need you to add the prices of the same sequence and with the same name
thank you