CRAN Status Badge DownloadsBuild Status

The furniture R package contains functions to help with data cleaning/tidying (e.g., washer(), rowmeans(), rowsums()), exploratory data analysis and reporting (e.g., table1(), tableC(), tableF()). It currently contains eight main functions:

  1. table1() – gives a well-formatted table for academic publication of descriptive statistics. Very useful for quick analyses as well. Notably, table1() now works with dplyr::group_by().
  2. tableC() – gives a well-formatted table of correlations.
  3. tableF() – provides a thorough frequency table for quick checks of the levels of a variable.
  4. washer() – changes several values in a variable (very useful for changing place holder values to missing).
  5. long() – is a wrapper of stats::reshape(), takes the data from wide to long format (long is often the tidy version of the data), works well with the tidyverse, and can handle unbalanced multilevel data.
  6. wide() – also a wrapper of stats::reshape(), takes the data from long to wide, and like long(), works well with the tidyverse and can handle unbalanced multilevel data.
  7. rowmeans() and mutate_rowmeans() – tidyverse friendly versions of rowMeans()
  8. rowsums() and mutate_rowsums() – tidyverse friendly versions of rowSums()

In conjunction with many other tidy tools, the package should be useful for health, behavioral, and social scientists working on quantitative research.

Installation

The latest stable build of the package can be downloaded from CRAN via:

You can download the developmental version via:

library(devtools)
install_github("tysonstanley/furniture")

Using furniture

The main functions are the table_() functions (e.g., table1(), tableC(), tableF()).

#> Loading furniture
#> ── furniture 1.8.2 ──────────────────────────────────────────────────────────────────────────────────────────────────────────── learn more at tysonbarrett.com ──
#> ✔ furniture attached
#> ✔ No potential conflicts found

table1() can be outputted directly to other formats. All knitr::kable() options are available for this and there is an extra option "latex2" which provides a publication ready table in Latex documents.

In addition, the rowmeans() and rowsums() functions offer a simplified use of rowMeans() and rowSums(), particularly when using the tidyverse’s mutate().

Notes

The package is most useful in conjunction with other tidy tools to get data cleaned/tidied and start exploratory data analysis. I recommend using packages such as library(dplyr), library(tidyr), and library(ggplot2) with library(furniture) to accomplish this.

The most important function–table1–is simply built for both exploratory descriptive analysis and communication of findings. See vignettes or tysonstanley.github.io for several examples of its use. Also see our paper in the R Journal.