tidystats icon indicating copy to clipboard operation
tidystats copied to clipboard

Support for data.frames

Open gasparl opened this issue 2 years ago • 5 comments

How about adding support for any sort of data.frame (and perhaps matrix)? This is really simple and would cover any conceivable statistics that can be put in a table format. I already have a helper function for it (df_to_group; it was needed for metafor's data.frame outputs), so we would just need to wrap it under a tidy_stats class.

gasparl avatar Jun 16 '22 09:06 gasparl

That makes sense. Although it will be a bit tricky to figure out the symbols and potential subscripts. Although we could just omit those things.

WillemSleegers avatar Jun 16 '22 09:06 WillemSleegers

Yes, it could be either omitted or added as optional via a parameter. (I already have a short list of replacements for "frequently occurring" symbols, see here; this could be expanded and used for this purpose.)

gasparl avatar Jun 16 '22 09:06 gasparl

Good idea. It could be an optional argument that takes either a vector or a list. A vector could be provided in case the user wants to provide a symbol/subscript for all stats, or a list in case only some of the statistics should have a symbol and/or subscript.

For example: df_to_group(df, symbols = list("estimate" = "t"))

WillemSleegers avatar Jun 16 '22 09:06 WillemSleegers

We should call the function something else though. Perhaps df_to_stats() or tidy_df().

WillemSleegers avatar Jun 16 '22 09:06 WillemSleegers

As discussed, this became part of the add_stats function (with additional optional parameters) rather than a function on its own; see implemented here. I guess a short description of the optional parameters should be given somewhere in the documentation. Let me know if I should add it (and if yes, where).

gasparl avatar Jun 20 '22 05:06 gasparl