Epiconcept-Paris / STRAP-epiuf

Utility function package for STRAP
0 stars 0 forks source link

crosstab() and epitable() investigate if we can have merge them and only have one function for 2by2 tables #74

Closed loremerdrignac closed 1 year ago

epi-gde commented 1 year ago

epitable already provide results very similar to crosstab by returning a list containing the table and several other info help have been updated to reflect current functionalities, examples have been added compare to crosstab, epitable provide "epidemiological order" for table with 0/1, Y/N or TRUE/FALSE values it also manage factor variable. Epitable count for missing without including them to the main table which allows to calculate true proportion while having missing value on the output. If needed, epitable could easily be modified to suppress output or to make marginal total optional Finally epitable syntax is more consistent with other function : when dataframe is provided as parameters, column are passed by there name instead of vectors ("var1" instead of data$var1)

loremerdrignac commented 1 year ago

@epi-jhd to check if epitable can now replace crosstab()

epi-jhd commented 1 year ago

Feature wishlist to boost utility of epitable and make it match crosstab (or match the addition that would be nice to add to crosstab!) 1) Be able to extract $colperc and $rowperc without including the total in $table. (OR include an explanation in the error message informing that must specify total = TRUE if wish to specify col = TRUE and/or row = TRUE, so that user can fix) 2) $colperc has an extra uneccesary column. image 3) Add option to include missing in the $table and percentage outputs 4) Add option to output percentage of the total (in addition to by row and column) 5) Add option to not automatically output the display

epi-jhd commented 1 year ago

@epi-gde and @loremerdrignac I can have a go at adding these features in a branch for you to review? (May not be as neat as your work Gilles!)

epi-gde commented 1 year ago

@epi-jhd Thanks for the review. Yes you can start with a new branch specifically for epitable changes and we can review the code together. Your 5 feature are ok for me ;)

epi-jhd commented 1 year ago

Where at with epitable: Formating for cols when have total = F (mind to load all the new functions!)

Hi! I have completed my edits the epitable functions, so that a) all combinations of true and false inputs for col, row, total and missing now work b) I have added an option 'tout' (I know, this is not good, but all other itterations of total were taken, suggestions welcome) that enables you to output a table or percentages from the whole data (as opposed to by row or column as present) c) I have added this new option to the displayed table, with a 'O' as signifyer (row uses ">" col uses 'V'.

The updates can be found in the branch epitable_20230727

epi-gde commented 1 year ago

Last minor changes, I added in roxygen the totperc option to get percentage/total (Was working but not visble in the code completion feature)

epi-gde commented 1 year ago

Included in Version 0.5.0.1