README.md

Development of this package has been abandoned

The main function in this package has now been incorporated into the official version of the htmlTable package, and development of this package will not longer be supported.

In the htmlTable package, the htmlTable_td function has been renamed to tidyHtmlTable with additional changes made to parameter names.

See ?tidyHtmlTable for further details.


# For the dev version of htmlTable
install.packages("devtools")
devtools::install_github("gforge/tidyhTbl")

# For the lastest CRAN release
install.packages("htmlTable")

Build Status

tidyhTbl

The goal of tidyhTbl is to wrap the htmlTable function from the htmlTable package for use with tidy data.

Installation

You can install tidyhTbl from github with:

install.packages("devtools")
devtools::install_github("graggsd/tidyhTbl")

Example

This is a basic example which shows you how to solve a common problem:

library(magrittr)
library(tidyr)
library(dplyr)
library(tidyhTbl)
library(tibble)
mtcars %>%
    rownames_to_column %>%
    select(rowname, cyl, gear, hp, mpg, qsec) %>%
    gather(per_metric, value, hp, mpg, qsec) %>%
    group_by(cyl, gear, per_metric) %>%
    summarise(Mean = round(mean(value), 1),
              SD = round(sd(value), 1),
              Min = round(min(value), 1),
              Max = round(max(value), 1)) %>%
     gather(summary_stat, value, Mean, SD, Min, Max) %>%
     ungroup %>%
     mutate(gear = paste(gear, "Gears"),
            cyl = paste(cyl, "Cylinders")) %>%
     htmlTable_td(header_td = "gear",
                  cgroup1_td = "cyl",
                  cell_value = "value",
                  rnames_td = "summary_stat",
                  rgroup_td = "per_metric")
4 Cylinders   6 Cylinders   8 Cylinders 1 2 3   4 5 6   7 8 1 97 109 113   110 123 175   245 335 2 97 76 102   107.5 116.5 175   194.2 299.5 3 97 52 91   105 110 175   150 264 4 NaN 20.1 15.6   3.5 7.5 NaN   33.4 50.2 5 21.5 33.9 30.4   21.4 21 19.7   19.2 15.8 6 21.5 26.9 28.2   19.8 19.8 19.7   15.1 15.4 7 21.5 21.4 26   18.1 17.8 19.7   10.4 15 8 NaN 4.8 3.1   2.3 1.6 NaN   2.8 0.6 9 20 22.9 16.9   20.2 18.9 15.5   18 14.6 10 20 19.6 16.8   19.8 17.7 15.5   17.1 14.6 11 20 18.5 16.7   19.4 16.5 15.5   15.4 14.5 12 NaN 1.5 0.1   0.6 1.1 NaN   0.8 0.1

graggsd/tidyhTbl documentation built on May 28, 2019, 8:54 p.m.