Learn R Programming

canprot (version 0.1.2)

xsummary: Summarize Compositional Differences

Description

Make an HTML table summarizing compositional differences.

Usage

xsummary(comptab, vars=c("ZC", "nH2O"))

Arguments

comptab

list or data frame, summary of comparisons generated by get_comptab

vars

character, two variables to tabulate

Details

This function makes an HTML table (using xtable) and adds bold and underline formatting to highlight significant compositional differences. The p-value is bolded if it is less than 0.05, and the percent common language effect size (CLES) is bolded if it is <= 40 or >= 60. The median or mean difference is [underlined / bolded] if [only one of / both] the p-value and CLES pass these cutoffs.

The generated table is written to the console, and can be used in a vignette using the results = "asis" chunk option. The function also returns (invisibly) the data frame used to make the table; this data frame differs from comptab by having row names added (alphabetical one-letter IDs for the datasets).

Examples

Run this code
# NOT RUN {
library(CHNOSZ)
comptab <- lapply(c("JKMF10", "WDO+15_C.N"), function(dataset) {
  pdat <- get_pdat(dataset)
  get_comptab(pdat)
})
xsummary(comptab)
# }

Run the code above in your browser using DataLab