Closed DanChaltiel closed 1 year ago
I think this is probably a good idea, but I don't think it would preserve attributes; fct()
is a constructor not a coercer.
I've changed my mind: I think fct()
is basically a constructor function; and it should only work with character vectors.
Hi,
Like its old cousin
factor()
, it would be nice iffct()
could be useful on factors too. For instance, I would expect this to work withfct()
(although I know I could do it withfct_expand()
):In fact, when dealing with tables containing character and factor columns, it can happen to be very useful to be able to use
fct()
on both indifferently.However, using
fct()
on factors will throw an error (unlikefactor()
):Created on 2022-12-02 with reprex v2.0.2
Even on factors,
fct()
would keep its loved advantages overfactor()
, such as preserving attributes.