isubirana / compareGroups

R package to easily build publication-ready univariate or bivariate descriptive tables from a data set.
https://isubirana.github.io/compareGroups/
33 stars 14 forks source link

Subset by overall p-value #4

Closed tiagochst closed 5 years ago

tiagochst commented 5 years ago

Hello,

Please, is it possible to subset the results to show only variables with overall p-value below a certain threshold ? I could not find that explicit in the vignette.

Thanks!

isubirana commented 5 years ago

Hi,

Although there is no specific function or argument to select significant variables, you can use the getResults to retrieve the p-values and then make use of [] to select the variables from the descriptive table. Below there is an example:

library(compareGroups)
data(predimed)
tab <- descrTable(event ~ ., predimed)
pvals <- getResults(tab, "p.overall")
tab[pvals<0.05]

By the way, we will try to incorporate a new function to do this more intuitively. Many thanks for your feed back.

Isaac.