Coming from SAS, there are some excellent Macros in SAS that made life much easier.
One such Marco helped create a "demographics table"... Basically the macro needs the following info
- List of continuous variables in the dataset
- List of categorical variables in the dataset
- A "group by" variable
The macro then generates a table (and exports it to word with a very nice format) the table containing:
- The min, p25, mean, median, p75, max for each continuous variable for the two levels of the "group by" variable
- The number and percentage of each categorical variable for the two levels of the "by group" variable
- t-test or Mann-Whitney comparison between the two levels of the "by group" for each continuous variable
- Fisher exact or Chi-square between the two levels of the "by group" for each categorical variable
You can see what I mean by looking at the output in the following link under figure 2:
Could anyone please point me to a function or a similar way of doing this in R??