Open tdhock opened 7 months ago
Hi @tdhock,
Thank you, I will fix it in the near future.
I think I will change the test and leave identity
as default. This is because I mostly use to_wide for conversion from long form. In this case for each combination there should be only one value. And if there are more values then something is going wrong and an error message is absolutely appropriate.
Regards, Gregory
great, thanks, that sounds reasonable.
Hi @gdemin Recently data.table merged some new dcast code which uses more strict checking of fun.aggregate, which is supposed to be a function which returns a single value. This is documented on ?dcast: " The aggregating function should take a vector as input and return a single value (or a list of length one) as output."
Using new data.table from github master, we ran
example("to_wide")
which gave the following:Details: https://github.com/Rdatatable/data.table/issues/6032
It seems that
to_wide
is calling dcast withfun.aggregate=identity
which is problematic because that returns a vector with length>1. Can you please modify your code so that it uses afun.aggregate
that returns a single value? (length=1)Thanks in advance!