{"id":21600152,"url":"https://github.com/datalorax/sundry","last_synced_at":"2025-10-10T04:32:49.738Z","repository":{"id":53097648,"uuid":"52026171","full_name":"datalorax/sundry","owner":"datalorax","description":"A sundry of convenience functions","archived":false,"fork":false,"pushed_at":"2021-04-06T23:13:42.000Z","size":52,"stargazers_count":10,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-10T04:31:57.801Z","etag":null,"topics":[],"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/datalorax.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}},"created_at":"2016-02-18T17:43:07.000Z","updated_at":"2024-12-07T19:34:10.000Z","dependencies_parsed_at":"2022-08-23T21:41:22.908Z","dependency_job_id":null,"html_url":"https://github.com/datalorax/sundry","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/datalorax/sundry","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datalorax%2Fsundry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datalorax%2Fsundry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datalorax%2Fsundry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datalorax%2Fsundry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/datalorax","download_url":"https://codeload.github.com/datalorax/sundry/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datalorax%2Fsundry/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002675,"owners_count":26083442,"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","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-24T18:23:17.605Z","updated_at":"2025-10-10T04:32:49.724Z","avatar_url":"https://github.com/datalorax.png","language":"R","funding_links":[],"categories":[],"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}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"README-\"\n)\n```\n\n# sundry\n[![Travis-CI Build Status](https://travis-ci.org/datalorax/sundry.svg?branch=master)](https://travis-ci.org/datalorax/sundry)\n[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/4bmb4eqscdf3p6vb?svg=true)](https://ci.appveyor.com/project/DJAnderson07/sundry)\n[![codecov](https://codecov.io/gh/datalorax/sundry/branch/master/graph/badge.svg)](https://codecov.io/gh/datalorax/sundry)\n\nThe *sundry* package is a personal R package filled with functions that make my\nlife a little easier when working on day-to-day analyses. Most of the functions\nin the package are designed to be friendly with the \n[tidyverse](https://www.tidyverse.org) and thus are pipe friendly (`%\u003e%`), and\nwork with other functions like `dplyr::group_by`. The package is somewhat perpetually under development. \n\n## Installation\n\nYou can install sundry from github with:\n\n```{r gh-installation, eval = FALSE}\n# install.packages(\"devtools\")\ndevtools::install_github(\"datalorax/sundry\")\n```\n\n## Examples\n\nBelow are a few examples of functions in the package.\n\n### Batch import data and bind into a single data frame\n\nMaybe my favorite function in the package is the `read_files` function, which \nwill read in *n* datasets and, if possible bind them together into a single \ntibble (data frame). The function uses `rio::import`, which makes it really\nnice because you don't have to worry about file types basically at all, and\nyou can even read in data of different types all at once.\n\n```{r read_files}\nlibrary(sundry)\nlibrary(tidyverse)\nby_species \u003c- iris %\u003e%\n  split(.$Species) %\u003e%\n  map(select, -Species)\n\nstr(by_species)\n\n# export as three different file types\nrio::export(by_species$setosa, \"setosa.csv\")\nrio::export(by_species$versicolor, \"versicolor.xlsx\")\nrio::export(by_species$virginica, \"virginica.sav\")\n\n# import them all back in as a single data frame\nd \u003c- read_files()\nd\nd %\u003e% \n  count(file)\n\nfs::file_delete(c(\"setosa.csv\", \"versicolor.xlsx\", \"virginica.sav\"))\n```\n\nThe first argument is the directory, and defaults to the current working \ndirectory. There's also an optional `pat` argument you can supply to read in \nonly files with a specified pattern.  You can also optionally have the files \nread in as a list, rather than binding the data frames together.\n\n### Quickly calculate descriptive stats\n\nQuickly calculate descriptive stats for any set of variables.\n\n```{r descriptive_stats, message = FALSE}\nlibrary(dplyr)\nlibrary(sundry)\nstorms %\u003e% \n  descrips(wind, pressure)\n\nstorms %\u003e% \n  group_by(year) %\u003e% \n  descrips(wind, pressure)\n\nstorms %\u003e% \n  group_by(year) %\u003e% \n  descrips(wind, pressure,\n           .funs = funs(qtile25 = quantile(., 0.25),\n                        median, \n                        qtile75 = quantile(., 0.75)))\n```\n\n### Remove empty rows from specific columns\nThis function is similar to `janitor::remove_empty_rows`, but allows you to \npass a set of columns (rather than looking across all columns). Rows will be\nremoved that are missing across all columns.\n\n```{r load_data}\nd \u003c- rio::import(\"http://www.oregon.gov/ode/educator-resources/assessment/TestResults2017/pagr_schools_ela_tot_ecd_ext_gnd_lep_1617.xlsx\",\n            setclass = \"tbl_df\",\n            na = c(\"--\", \"*\")) %\u003e% \n  janitor::clean_names()\n\nd %\u003e% \n  select(district_id, number_level_4:percent_level_1)\n```\n\nThe data above have missing data across many columns, but every row has at \nleast some valid entries. Suppose I was only interested in data on schools with \nproficiency data. \n\n```{r label, options}\nd %\u003e% \n  rm_empty_rows(number_level_4:percent_level_1) %\u003e% \n  select(district_id, number_level_4:percent_level_1) \n```\n\nThe above returns all the rows that are not missing across the full set of variables supplied (rows with partial missing are still returned). The function can also be provided without any column arguments, and the function will then mimic the behavior or `janitor::remove_empty_rows`. \n\n### Filter by Functions\nSelect rows according to functions. For example, select only the rows with the minimum and maximum values of a specific variable.\n\n```{r filter_by_funs}\nstorms %\u003e%\n filter_by_funs(wind, funs(min, max))\n\nstorms %\u003e%\n  group_by(year) %\u003e%\n  filter_by_funs(wind, funs(min, median, max)) %\u003e%\n  arrange(year)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatalorax%2Fsundry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatalorax%2Fsundry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatalorax%2Fsundry/lists"}