CompareGroups package in R

402 views Asked by At

I have a dataset with 100 columns and 4 groups.

I want to apply compareGroups function to have descriptive and inferential statistics for my data.

However; compareGroups function is taking a formula as follows: compareGroups(Grouping variable~variable1+variable2..and so on). what would be the code to use compareGroups for the whole 100 columns without specifying name of each and every column in my dataset?

Thanks in advance

1

There are 1 answers

1
user16949460 On BEST ANSWER

Try:

compareGroups(Grouping variable ~ ., data = dataframe)

The . refers to all other ("explanatory") variables.

Please note that compareGroups performs a univariate analysis with the dataframe between group (“response” variable) and all other variables (“explanatory” variables).

For more information see the compareGroups vignette.