Open rossellhayes opened 7 months ago
Yeah, seems like an oversight because there is one for variables.
A complication I can foresee would be that I don't think the category metadata schema is consistent between variables. Do you think numeric_value
or datetime
column should always be present, or only when relevant?
I think my expectation would be that an as.data.frame()
method would produce a data frame that looks like the print method for Categories
objects, i.e. only including the columns that are relevant for that variable type, but I would be happy with either implementation!
I think I have a method for this already in crunchtabs. I think it's in codebook. https://github.com/Crunch-io/crunchtabs/blob/main/R/codeBookSummary.R#L137
Including an
as.data.frame()
method forCategories
objects would make it easier to use join functions to map between the names and numeric codes associated with a variable.Here are the functions that I'm currently using in my scripts to achieve this: