I’ve come up against a wall, and believe I am missing something quite simple.
I have a list that contains results from multiple wilcoxon tests (with Bonferroni corrections) and would like to produce a similar-looking table to the output of the Dunnett’s test using multcomp (i.e., with no row numbers showing up and nicely spaced).

When I print it as a dataframe, the row numbers show up and the text values in the columns are right-justified.
The list is created by:
for (i in 2:length(split.set)) { wrs.mod <- suppressWarnings(wilcox.test(split.set[[1]]$VALUE, split.set[[i]]$VALUE)) stn.results[i - 1] <- as.character(unique(split.set[[i]]$TREATMENT)) stat.results[i - 1] <- as.numeric(wrs.mod$statistic) p.results[i - 1] <- signif(wrs.mod$p.value, 3) if (wrs.mod$p.value < 0.05/(length(split.set) - 1)) sig.results[i - 1] <- "*" else sig.results[i - 1] <- NA } wrs.results <- list(Treatment = stn.results, Statistic = stat.results, p = p.results, Significant = sig.results)
How do I format this into a decent looking table for printing?
Instead of formatting it as a
list, format it as adata.frameand print that:You can customize the structure (and therefore the look) of the data frame in a couple of ways. You might prefer treatment to be row names:
or customize the column names: