There are two issued with mergeDesc() in the latest develop version:
It discards p-values when the summary consists of more than one line, for example because missing values are shown, and rgroup and n.rgroup are specified.
p-values for one-line summaries are shown on the summary line instead of on the rgroup title line, when rgroup and n.rgroup are specified. It would look nicer if all p-values were shown on the rgroup title line.
Example below:
library(Gmisc)
data("mtcars")
cars_missing <- mtcars
cars_missing$mpg[3] <- NA
# p-values are not displayed when rgroup and n.rgroup are specified
mergeDesc(getDescriptionStatsBy(x = cars_missing$mpg,
by = cars_missing$cyl,
statistics = TRUE),
htmlTable_args = list(rgroup = c("Gas"),
n.rgroup = 2))
# p-values are displayed when rgroup and n.rgroup are not specified
mergeDesc(getDescriptionStatsBy(x = cars_missing$mpg,
by = cars_missing$cyl,
statistics = TRUE))
# p-values are displayed for one-line summaries only when rgroup and n.rgroup are specified
# but in the wrong place - they should be on the rgroup title line, not on the summary line
mergeDesc(getDescriptionStatsBy(x = cars_missing$mpg,
by = cars_missing$cyl,
statistics = TRUE),
getDescriptionStatsBy(x = cars_missing$disp,
by = cars_missing$cyl,
statistics = TRUE),
htmlTable_args = list(rgroup = c("Gas", "Displacement"),
n.rgroup = c(2, 1)))
# p-values are displayed for both summaries when rgroup and n.rgroup are not specified
mergeDesc(getDescriptionStatsBy(x = cars_missing$mpg,
by = cars_missing$cyl,
statistics = TRUE),
getDescriptionStatsBy(x = cars_missing$disp,
by = cars_missing$cyl,
statistics = TRUE))
p-values are not displayed when rgroup and n.rgroup are specified
4
6
8
P-value
Gas
Mean (SD)
27.1 (±4.6)
19.7 (±1.5)
15.1 (±2.6)
Missing
1 (9.1%)
0 (0%)
0 (0%)
p-values are displayed when rgroup and n.rgroup are not specified
4
6
8
P-value
cars_missing$mpg
< 0.0001
Mean (SD)
27.1 (±4.6)
19.7 (±1.5)
15.1 (±2.6)
Missing
1 (9.1%)
0 (0%)
0 (0%)
p-values are displayed for one-line summaries only when rgroup and n.rgroup are specified, but in the wrong place - they should be on the rgroup title line, not on the summary line
4
6
8
P-value
Gas
Mean (SD)
27.1 (±4.6)
19.7 (±1.5)
15.1 (±2.6)
Missing
1 (9.1%)
0 (0%)
0 (0%)
Displacement
cars_missing$disp
105.1 (±26.9)
183.3 (±41.6)
353.1 (±67.8)
< 0.0001
p-values are displayed for both summaries when rgroup and n.rgroup are not specified
There are two issued with
mergeDesc()
in the latest develop version:rgroup
andn.rgroup
are specified.rgroup
title line, whenrgroup
andn.rgroup
are specified. It would look nicer if all p-values were shown on thergroup
title line.Example below:
p-values are not displayed when rgroup and n.rgroup are specified
p-values are displayed when rgroup and n.rgroup are not specified
p-values are displayed for one-line summaries only when rgroup and n.rgroup are specified, but in the wrong place - they should be on the rgroup title line, not on the summary line
p-values are displayed for both summaries when rgroup and n.rgroup are not specified