regroup regroup two descriptive tables (qualitative or quantitative) into one

regroup(x, y, ...)

# S3 method for desc
regroup(x, y, rbind.label = "Response", ...)

Arguments

x

A desc object

y

A desc object

...

Other parameters

rbind.label

Character. The label for rbind column header

Value

A desc object corresponding to a table of statistics.

Details

Regroup a quantitative table and a qualitative table, is only possible if there is one and only one explicative variable. So it works if and only if x1 argument in x and y objects are not NULL, are the same and if x2 argument is NULL in both x and y objects.

The function takes the y.label argument of object x and y respectively as label for the levels of the new column created under the name of rbind.label (see example below)

It's also possible to regroup two quantitative tables, in this case it's possible if there is one or two explicative variables.

For now it's not possible to regroup two qualitative tables.

See also

Examples

data(datafake) # Example with a qualitative and a quantitative tables #The argument y.label is stored in the desc object and # only used after by the regroup function tab1=report.quanti(data=datafake,y="y_numeric", x1="GROUP",subjid="SUBJID",y.label="Y numeric") tab2=report.quali(data=datafake,y="y_logistic", x1="GROUP",subjid="SUBJID",y.label="Y logistic") regroup(tab1,tab2,rbind.label="The label of your choice")
#> #> ############################################ #> #> ############################################ #> #> The label of your choice Levels Statistics A (N=30) B (N=21) #> 1 Y numeric N 180 120 #> 2 Y numeric Mean (SD) 1.46(1.50) 3.15(2.00) #> 3 Y numeric Median 1.59 3.75 #> 4 Y numeric [Q1;Q3] [0.45;2.50] [2.46;4.44] #> 5 Y numeric [Min;Max] [-2.34;4.36] [-2.44;6.19] #> 6 Y numeric Missing 4 4 #> 7 #> 8 Y logistic 0 n (column %) 79(43.89%) 60(50.00%) #> 9 Y logistic 1 n (column %) 97(53.89%) 59(49.17%) #> 10 Y logistic Missing n(%) 4(2.22%) 1(0.83%) #> C (N=17) #> 1 96 #> 2 3.87(2.52) #> 3 4.73 #> 4 [3.44;5.30] #> 5 [-2.99;7.96] #> 6 2 #> 7 #> 8 47(48.96%) #> 9 44(45.83%) #> 10 5(5.21%) #> #> ############################################ #>
# Example with 2 quantitative tables tab1=report.quanti(data=datafake,y="y_numeric", x1="GROUP",subjid="SUBJID",y.label="Y numeric") datafake$y_numeric2=rnorm(length(datafake$y_numeric)) tab2=report.quanti(data=datafake,y="y_numeric2", x1="GROUP",subjid="SUBJID",y.label="Y Numeric 2") regroup(tab1,tab2,rbind.label="The label of your choice")
#> #> ############################################ #> #> ############################################ #> #> The label of your choice Statistics A (N=30) B (N=21) C (N=17) #> 1 Y numeric N 180 120 96 #> 2 Y numeric Mean (SD) 1.46(1.50) 3.15(2.00) 3.87(2.52) #> 3 Y numeric Median 1.59 3.75 4.73 #> 4 Y numeric [Q1;Q3] [0.45;2.50] [2.46;4.44] [3.44;5.30] #> 5 Y numeric [Min;Max] [-2.34;4.36] [-2.44;6.19] [-2.99;7.96] #> 6 Y numeric Missing 4 4 2 #> 7 #> 8 Y Numeric 2 N 180 120 96 #> 9 Y Numeric 2 Mean (SD) 0.06(1.05) 0.04(1.02) 0.20(0.99) #> 10 Y Numeric 2 Median 0.09 0.07 0.03 #> 11 Y Numeric 2 [Q1;Q3] [-0.58;0.77] [-0.64;0.68] [-0.41;0.93] #> 12 Y Numeric 2 [Min;Max] [-2.61;2.65] [-2.18;2.76] [-2.27;2.68] #> 13 Y Numeric 2 Missing 0 0 0 #> #> ############################################ #>