Skip to content

Change in list naming behavior when using overall and extra.col #141

@nabihlme

Description

@nabihlme

In version 1.4.3, the Overall column was always presented to the extra.col function with the name "overall" (lower case). It did not matter whether the Overall column was named, placed on the left, set to TRUE, or otherwise not specified (default). In version 1.5.1, the Overall column is named exactly as specified in the function call.

Version 1.4.3:

table1(~ stuff | study, data=data, overall=c(left="Col"), extra.col=list(Pvalue=function(x,...){assign("x", x, envir=.GlobalEnv)})) ; names(x)
[1] "overall" "Study1" "Study2"
table1(~ stuff | study, data=data, overall="Col", extra.col=list(Pvalue=function(x,...){assign("x", x, envir=.GlobalEnv)})) ; names(x)
[1] "Study1" "Study2" "overall"
table1(~ stuff | study, data=data, overall=T, extra.col=list(Pvalue=function(x,...){assign("x", x, envir=.GlobalEnv)})) ; names(x)
[1] "Study1" "Study2" "overall"
table1(~ stuff | study, data=data, extra.col=list(Pvalue=function(x,...){assign("x", x, envir=.GlobalEnv)})) ; names(x)
[1] "Study1" "Study2" "overall"

Version 1.5.1:

table1(~ stuff | study, data=data, overall=c(left="Col"), extra.col=list(Pvalue=function(x,...){assign("x", x, envir=.GlobalEnv)})) ; names(x)
[1] "Col" "Study1" "Study2"
table1(~ stuff | study, data=data, overall="Col", extra.col=list(Pvalue=function(x,...){assign("x", x, envir=.GlobalEnv)})) ; names(x)
[1] "Study1" "Study2" "Col"
table1(~ stuff | study, data=data, overall=T, extra.col=list(Pvalue=function(x,...){assign("x", x, envir=.GlobalEnv)})) ; names(x)
[1] "Study1" "Study2" "TRUE"
table1(~ stuff | study, data=data, extra.col=list(Pvalue=function(x,...){assign("x", x, envir=.GlobalEnv)})) ; names(x)
[1] "Study1" "Study2" "Overall" (Title case)

I had been relying on the previous behavior to set the overall column to NULL before calculating pvalues.
x$overall = NULL

The behavior is also used here:
#138 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions