{"id":14066416,"url":"https://github.com/brad-cannell/freqtables","last_synced_at":"2025-07-04T08:02:29.565Z","repository":{"id":44383735,"uuid":"227701467","full_name":"brad-cannell/freqtables","owner":"brad-cannell","description":"Quickly make tables of descriptive statistics (i.e., counts, percentages, confidence intervals) for categorical variables. This package is designed to work in a tidyverse pipeline, and consideration has been given to get results from R to Microsoft Word ® with minimal pain.","archived":false,"fork":false,"pushed_at":"2024-02-17T22:08:52.000Z","size":3721,"stargazers_count":12,"open_issues_count":23,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-24T05:18:39.910Z","etag":null,"topics":["categorical-data","data-analysis","descriptive-statistics","epidemiology","r"],"latest_commit_sha":null,"homepage":null,"language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brad-cannell.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2019-12-12T21:39:59.000Z","updated_at":"2024-05-30T09:07:12.000Z","dependencies_parsed_at":"2024-02-17T23:19:36.373Z","dependency_job_id":"747355ff-6975-4c24-a5e6-c8c3c9745780","html_url":"https://github.com/brad-cannell/freqtables","commit_stats":{"total_commits":55,"total_committers":1,"mean_commits":55.0,"dds":0.0,"last_synced_commit":"190b6f54c374ea952ee747518c7514e257824d58"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brad-cannell%2Ffreqtables","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brad-cannell%2Ffreqtables/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brad-cannell%2Ffreqtables/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brad-cannell%2Ffreqtables/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brad-cannell","download_url":"https://codeload.github.com/brad-cannell/freqtables/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228060232,"owners_count":17863361,"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":["categorical-data","data-analysis","descriptive-statistics","epidemiology","r"],"created_at":"2024-08-13T07:05:05.290Z","updated_at":"2024-12-04T06:30:56.442Z","avatar_url":"https://github.com/brad-cannell.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, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n# freqtables \u003cimg style=\"padding: 15px;\" align=\"left\" src=\"man/figures/freqtables_hex/freqtables.png\" alt=\"freqtables hex logo\" width=\"250\" height=\"289\"\u003e\n\n\u003c!-- badges: start --\u003e\n[![CRAN status](https://www.r-pkg.org/badges/version/freqtables)](https://cran.r-project.org/package=freqtables)\n[![Downloads](http://cranlogs.r-pkg.org/badges/grand-total/freqtables)](https://www.r-pkg.org/pkg/freqtables)\n\u003c!-- badges: end --\u003e\n\nThe goal of `freqtables` is to quickly make tables of descriptive statistics for categorical variables (i.e., counts, percentages, confidence intervals). This package is designed to work in a `tidyverse` pipeline, and consideration has been given to get results from R to Microsoft Word ® with minimal pain.\n\n## Installation\n\nYou can install the released version of `freqtables` from [CRAN](https://CRAN.R-project.org) with:\n\n``` r\ninstall.packages(\"freqtables\")\n```\n\nAnd the development version from [GitHub](https://github.com/) with:\n\n``` r\n# install.packages(\"devtools\")\ndevtools::install_github(\"brad-cannell/freqtables\")\n```\n## Example\n\nBecause `freqtables` is intended to be used in a `dplyr` pipeline, loading `dplyr` into your current R session is recommended.\n\n```{r message=FALSE}\nlibrary(dplyr)\nlibrary(freqtables)\n```\n\nThe examples below will use R's built-in `mtcars` data set.\n\n```{r}\ndata(\"mtcars\")\n```\n\n### freq_table()\n\nThe `freq_table()` function produces one-way and two-way frequency tables for categorical variables. In addition to frequencies, the `freq_table()` function displays percentages, and the standard errors and confidence intervals of the percentages. For two-way tables only, `freq_table()` also displays row (subgroup) percentages, standard errors, and confidence intervals.\n\nFor one-way tables, the default 95 percent confidence intervals displayed are logit transformed confidence intervals equivalent to those used by Stata. Additionally, `freq_table()` will return Wald (\"linear\") confidence intervals if the argument to ci_type = \"wald\".\n\nFor two-way tables, `freq_table()` returns logit transformed confidence intervals equivalent to those used by Stata.\n\nHere is an example of using `freq_table()` to create a one-way frequency table with all function arguments left at their default values:\n\n```{r}\nmtcars %\u003e% \n  freq_table(am)\n```\n\nHere is an example of using `freq_table()` to create a two-way frequency table with all function arguments left at their default values:\n\n```{r}\nmtcars %\u003e% \n  freq_table(am, cyl)\n```\n\nYou can learn more about the `freq_table()` function and ways to adjust default behaviors in vignette(\"descriptive_analysis\").\n\n### freq_test()\n\nThe `freq_test()` function is an S3 generic. It currently has methods for conducting hypothesis tests on one-way and two-way frequency tables. Further, it is made to work in a dplyr pipeline with the `freq_table()` function.\n\nFor the `freq_table_two_way` class, the methods used are Pearson's chi-square test of independence Fisher's exact test. When cell counts are \u003c= 5, Fisher's Exact Test is considered more reliable.\n\nHere is an example of using `freq_test()` to test the equality of proportions on a one-way frequency table with all function arguments left at their default values:\n\n```{r}\nmtcars %\u003e%\n  freq_table(am) %\u003e%\n  freq_test() %\u003e%\n  select(var:percent, p_chi2_pearson)\n```\n\nHere is an example of using `freq_test()` to conduct a chi-square test of independence on a two-way frequency table with all function arguments left at their default values:\n\n```{r}\nmtcars %\u003e%\n  freq_table(am, vs) %\u003e%\n  freq_test() %\u003e%\n  select(row_var:n, percent_row, p_chi2_pearson)\n```\n\nYou can learn more about the `freq_table()` function and ways to adjust default behaviors in vignette(\"using_freq_test\").\n\n### freq_format()\n\nThe freq_format function is intended to make it quick and easy to format the output of the freq_table function for tables that may be used for publication. For example, a proportion and 95% confidence interval could be formatted as \"24.00 (21.00 - 27.00).\"\n\n```{r}\nmtcars %\u003e%\n  freq_table(am) %\u003e%\n  freq_format(\n    recipe = \"percent (lcl - ucl)\",\n    name = \"percent_95\",\n    digits = 2\n  ) %\u003e%\n  select(var, cat, percent_95)\n```\n\nYou can learn more about the `freq_format()` function by reading the function documentation.\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrad-cannell%2Ffreqtables","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrad-cannell%2Ffreqtables","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrad-cannell%2Ffreqtables/lists"}