I want to aggregate a dataset which includes time date and other variables. Now I met a problem when I want to record the earliest value of one variable during that day.I tried
dt[, .(new_var1 := dt[time==(min(time)), .(var1)), by = .(month,day)]
But it will return me many repeative rows. For one day, there will be many rows.