{"id":13858201,"url":"https://github.com/TysonStanley/furniture","last_synced_at":"2025-07-13T23:31:35.485Z","repository":{"id":43112846,"uuid":"62188820","full_name":"TysonStanley/furniture","owner":"TysonStanley","description":"The furniture R package contains table1 for publication-ready simple and stratified descriptive statistics, tableC for publication-ready correlation matrixes, and other tables #rstats","archived":false,"fork":false,"pushed_at":"2024-02-13T18:37:04.000Z","size":4402,"stargazers_count":50,"open_issues_count":5,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-04T04:35:06.973Z","etag":null,"topics":["cran","descriptive-statistics","exploratory-data-analysis","health","table-one","table1","tables","tidy","tidyverse"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TysonStanley.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-06-29T02:23:57.000Z","updated_at":"2025-01-26T21:51:29.000Z","dependencies_parsed_at":"2022-08-30T00:12:07.649Z","dependency_job_id":"2d259e03-3ca7-4275-a94b-89f8600b2292","html_url":"https://github.com/TysonStanley/furniture","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/TysonStanley/furniture","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TysonStanley%2Ffurniture","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TysonStanley%2Ffurniture/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TysonStanley%2Ffurniture/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TysonStanley%2Ffurniture/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TysonStanley","download_url":"https://codeload.github.com/TysonStanley/furniture/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TysonStanley%2Ffurniture/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265220417,"owners_count":23729809,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cran","descriptive-statistics","exploratory-data-analysis","health","table-one","table1","tables","tidy","tidyverse"],"created_at":"2024-08-05T03:02:00.316Z","updated_at":"2025-07-13T23:31:30.470Z","avatar_url":"https://github.com/TysonStanley.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, echo = FALSE, message=FALSE, warning=FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"README-\"\n)\ndevtools::load_all()\n```\n\n\u003c!-- badges: start --\u003e\n[![CRAN Status Badge](https://www.r-pkg.org/badges/version/furniture)](https://cran.r-project.org/package=furniture)\n![Downloads](https://cranlogs.r-pkg.org/badges/grand-total/furniture)\n[![R-CMD-check](https://github.com/TysonStanley/furniture/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/TysonStanley/furniture/actions/workflows/R-CMD-check.yaml)\n\u003c!-- badges: end --\u003e\n\n\n\n# furniture: `v1.10.0` \u003cimg src=\"man/figures/furniture_hex_v2_full.png\" align=\"right\" width=\"40%\" height=\"40%\" /\u003e\n\nThe 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:\n\n1. `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()`.\n2. `tableC()` : gives a well-formatted table of correlations.\n3. `tableF()` : provides a thorough frequency table for quick checks of the levels of a variable.\n4. `washer()` : changes several values in a variable (very useful for changing place holder values to missing).\n5. `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.\n6. `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.\n7. `rowmeans()` and `rowmeans.n()` : tidyverse friendly versions of `rowMeans()`, where the `rowmeans.n()` function allows `n` number of missing\n8. `rowsums()` and `rowsums.n()` : tidyverse friendly versions of `rowSums()`, where the `rowsums.n()` function allows `n` number of missing\n\nIn conjunction with many other tidy tools, the package should be useful for health, behavioral, and social scientists working on quantitative research.\n\n# Installation\n\nThe latest stable build of the package can be downloaded from CRAN via:\n\n```{r, eval = FALSE}\ninstall.packages(\"furniture\")\n```\n\nYou can download the developmental version via:\n\n```{r, eval = FALSE}\nremotes::install_github(\"tysonstanley/furniture\")\n```\n\n# Using furniture\n\nThe main functions are the `table*()` functions (e.g., `table1()`, `tableC()`, `tableF()`).\n\n```{r}\nlibrary(furniture)\n```\n\n```{r}\ndata(\"nhanes_2010\")\n\ntable1(nhanes_2010,\n       age, marijuana, illicit, rehab,\n       splitby=~asthma,\n       na.rm = FALSE)\n```\n\n```{r}\ntable1(nhanes_2010,\n       age, marijuana, illicit, rehab,\n       splitby=~asthma, \n       output = \"text2\",\n       na.rm = FALSE)\n```\n\n```{r, warning=FALSE, message=FALSE}\nlibrary(tidyverse)\nnhanes_2010 %\u003e%\n  group_by(asthma) %\u003e%\n  table1(age, marijuana, illicit, rehab,\n         output = \"text2\",\n         na.rm = FALSE)\n```\n\n`table1()` can do bivariate significance tests as well.\n\n```{r, warning=FALSE, message=FALSE}\nlibrary(tidyverse)\nnhanes_2010 %\u003e%\n  group_by(asthma) %\u003e%\n  table1(age, marijuana, illicit, rehab,\n         output = \"text2\",\n         na.rm = FALSE,\n         test = TRUE)\n```\n\nBy default it does the appropriate parametric tests. However, you can change that by setting `param = FALSE` (new with `v 1.9.1`).\n\n```{r, warning=FALSE, message=FALSE}\nlibrary(tidyverse)\nnhanes_2010 %\u003e%\n  group_by(asthma) %\u003e%\n  table1(age, marijuana, illicit, rehab,\n         output = \"text2\",\n         na.rm = FALSE,\n         test = TRUE,\n         param = FALSE,\n         type = \"condense\")\n```\n\nIt can also do a total column with the stratified columns (new with `v 1.9.0`) with the `total = TRUE` argument.\n\n```{r, warning=FALSE, message=FALSE}\nnhanes_2010 %\u003e%\n  group_by(asthma) %\u003e%\n  table1(age, marijuana, illicit, rehab,\n         output = \"text2\",\n         na.rm = FALSE,\n         test = TRUE,\n         type = \"condense\",\n         total = TRUE)\n```\n\nIt can also report the statistics in addition to the p-values.\n\n```{r, warning=FALSE, message=FALSE}\nnhanes_2010 %\u003e%\n  group_by(asthma) %\u003e%\n  table1(age, marijuana, illicit, rehab,\n         output = \"text2\",\n         na.rm = FALSE,\n         test = TRUE,\n         total = TRUE,\n         type = \"full\")\n```\n\n`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.\n\nA new function `table1_gt()` integrates the fantastic `gt` package to make beautiful HTML tables for table1.\n\n```{r, results='asis'}\nnhanes_2010 %\u003e% \n  group_by(asthma) %\u003e% \n  table1(age, marijuana, illicit, rehab, na.rm = FALSE) %\u003e% \n  table1_gt() %\u003e% \n  print()\n```\n\n\n\n\nThe `tableC()` function gives a well-formatted correlation table.\n\n```{r}\ntableC(nhanes_2010, \n       age, active, vig_active, \n       na.rm=TRUE)\n```\n\nThe `tableF()` function gives a table of frequencies.\n\n```{r}\ntableF(nhanes_2010, age)\n```\n\nIn addition, the `rowmeans()` and `rowsums()` functions offer a simplified use of `rowMeans()` and `rowSums()`, particularly when using the tidyverse's `mutate()`.\n\n```{r}\nnhanes_2010 %\u003e%\n  select(vig_active, mod_active) %\u003e%\n  mutate(avg_active = rowmeans(vig_active, mod_active, na.rm=TRUE)) %\u003e%\n  mutate(sum_active = rowsums(vig_active, mod_active, na.rm=TRUE)) %\u003e% \n  head()\n```\n\nThe `rowmeans.n()` and `rowsums.n()` allow `n` missing values while still calculating the mean or sum.\n\n```{r}\ndf \u003c- data.frame(\n  x = c(NA, 1:5),\n  y = c(1:5, NA)\n)\n\ndf %\u003e%\n  mutate(avg = rowmeans.n(x, y, n = 1))\n```\n\n## Notes\n\nThe 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.\n\nThe original function--`table1()`--is simply built for both exploratory descriptive analysis and communication of findings. See vignettes or [tysonbarrett.com](https://tysonstanley.github.io/) for several examples of its use. Also see our paper in the [R Journal](https://journal.r-project.org/archive/2017/RJ-2017-037/RJ-2017-037.pdf).\n\n\n\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTysonStanley%2Ffurniture","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTysonStanley%2Ffurniture","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTysonStanley%2Ffurniture/lists"}