tableone icon indicating copy to clipboard operation
tableone copied to clipboard

Generate legend or summary text to accompany the table

Open tompollard opened this issue 6 years ago • 2 comments

Consider generating a legend populated with details of the table. e.g. this might include:

  • warnings related to #22 and #23
    • notes on p-values
  • notes on summary statistics

tompollard avatar Feb 22 '18 16:02 tompollard

So, what I was think of was explainr. https://github.com/hilaryparker/explainr

ptest <- prop.test(x = 500, n = 1008)
explain(ptest)

Yields text generated from a template:

This was a one-sample proportion test of the null hypothesis that the true population proportion is equal to 0.5. Using a significance level of 0.05, we do not reject the null hypothesis, and cannot conclude that true population proportion is different than 0.5. The observed sample proportion is 0.496031746031746 (500 events out of a total sample size of 1,008).

The confidence interval for the true population proportion is (0.464746, 0.5273481). This interval will contain the true population proportion 95 times out of 100.

The p-value for this test is 0.8254979. This, formally, is defined as the probability -- if the null hypothesis is true -- of observing a sample proportion that is as or more extreme than the sample proportion from this data set. In this case, this is the probability -- if the true population proportion is 0.5 -- of observing a sample proportion that is greater than 0.503968253968254 or less than 0.4960317460

TBH, this is probably a separate package

jraffa avatar Feb 26 '18 18:02 jraffa

the explain() functionality is something that could be nice to implement. explain(var) could be a method called on the tableone object to give a more human readable explanation of the data for this particular variable (e.g. tableone.explain(age)).

tompollard avatar Mar 12 '18 19:03 tompollard