report_continuous | R Documentation |
report_medianIQR builds a summary table with the overall mean and sd or medians and quartiles of one or more variables depending on whether the variable is normal or not. A grouping variable can also be specified, in which case means and sd (or medians and quartiles) are also calculated for each group. When means and sd are reported, the p-value of an anova test for testing the significance of the differences between the means is shown. When the reported values are medians and quartiles, the p-value of a Kruskal-Wallis test is displayed to test the null hypothesis that the location parameters of the distribution of the variable are the same in each group.
report_continuous(
data,
summary_vars,
groupVar = NULL,
digits = 2,
probs = c(0.25, 0.75),
pvdigits = 4,
alpha = 0.05,
na.rm = TRUE
)
data |
data frame or tibble which contains the data. |
summary_vars |
Variable or variables whose summary measures (mean±sd or median±IQR) are to be calculated. |
groupVar |
Grouping variable. |
digits |
Number of decimal digits for the results. |
probs |
Pair of quantiles to be computed around the median. Default are q25 and q75. |
pvdigits |
Number of decimal digits for the p-value of Kruskal test. |
alpha |
Decision on computing mean±sd or median±IQR is made depending on the result of a Shapiro Wilk test of normality. The value of alpha is the significance level for that test. |
na.rm |
Should NA values be removed (possible values are TRUE or FALSE) |
roundFrom |
If median is greater than this value, median and IQR are rounded to zero decimals even if digits>0. |
A table with the overall median and quartiles of the variables and, if a grouping variable is specified, the medians and quartiles by group and the p-value of the kruskal test for comparing location parameters.
df <- data.frame(x=rnorm(100,10,3),y=rnorm(100,50,8), z=runif(100,20,30),g=sample(c("Yes","No"),100,replace=TRUE))
df %>%
report_continuous(c(x,y,z)) # Only overall summary of variables x, y and z
df %>%
report_continuous(c(x,y,z), groupVar=g, digits=1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.