Misleading error when using pad on grouped df
danielsjf opened this issue · 1 comments
danielsjf commented
When the date column is grouped, pad returns a misleading error.
# This works
data.frame(a = ISOdate(2017,7,13,c(1:5,4,15)), b = c(1,1,1,1,2,2,2), y =1:7) %>%
padr::pad()
# This returns "Error: Column `a` must have a unique name"
data.frame(a = ISOdate(2017,7,13,c(1:5,4,15)), b = c(1,1,1,1,2,2,2), y =1:7)%>%
group_by(a,b) %>%
padr::pad()
When one of the columns is grouped, it could instead return something like:
"Column a
exists but is grouped. Ungroup this column before using pad."
EdwinTh commented
I agree with you there should be a more informative error there. However I would prefer to make explicit that the grouping cannot be on the datetime variable. Will implement in at the next release. Thanks for bringing it to my attention.