{"id":27879380,"url":"https://github.com/gesistsa/minty","last_synced_at":"2025-05-05T03:21:18.471Z","repository":{"id":227330475,"uuid":"770871030","full_name":"gesistsa/minty","owner":"gesistsa","description":"🌿MINimal TYpe guesser","archived":false,"fork":false,"pushed_at":"2025-04-04T08:56:16.000Z","size":2239,"stargazers_count":7,"open_issues_count":4,"forks_count":0,"subscribers_count":2,"default_branch":"v0.0","last_synced_at":"2025-04-26T09:39:45.256Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://gesistsa.github.io/minty/","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/gesistsa.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,"publiccode":null,"codemeta":null}},"created_at":"2024-03-12T10:03:28.000Z","updated_at":"2025-04-13T09:19:36.000Z","dependencies_parsed_at":"2024-03-18T14:46:02.669Z","dependency_job_id":"7751387c-e758-4581-845f-8fac0d120bcf","html_url":"https://github.com/gesistsa/minty","commit_stats":null,"previous_names":["chainsawriot/minty"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gesistsa%2Fminty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gesistsa%2Fminty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gesistsa%2Fminty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gesistsa%2Fminty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gesistsa","download_url":"https://codeload.github.com/gesistsa/minty/tar.gz/refs/heads/v0.0","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252430272,"owners_count":21746629,"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":[],"created_at":"2025-05-05T03:21:17.735Z","updated_at":"2025-05-05T03:21:18.443Z","avatar_url":"https://github.com/gesistsa.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, 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# minty \u003cimg src=\"man/figures/logo.png\" align=\"right\" height=\"138\" alt = \"\"/\u003e\n\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/gesistsa/minty/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/gesistsa/minty/actions/workflows/R-CMD-check.yaml)\n[![CRAN status](https://www.r-pkg.org/badges/version/minty)](https://CRAN.R-project.org/package=minty)\n\u003c!-- badges: end --\u003e\n\n`minty` (**Min**imal **ty**pe guesser) is a package with the type inferencing and parsing tools (the so-called 1e parsing engine) extracted from `readr` (with permission, see this issue [tidyverse/readr#1517](https://github.com/tidyverse/readr/issues/1517)). Since July 2021, these tools are not used internally by `readr` for parsing text files. Now `vroom` is used by default, unless explicitly call the first edition parsing engine (see the explanation on [editions](https://github.com/tidyverse/readr?tab=readme-ov-file#editions)).\n\n`readr`'s 1e type inferencing and parsing tools are used by various R packages, e.g. `readODS` and `surveytoolbox` for parsing in-memory objects, but those packages do not use the main functions (e.g. `readr::read_delim()`) of `readr`. As explained in the README of `readr`, those 1e code will be eventually removed from `readr`.\n\n`minty` aims at providing a set of minimal, long-term, and compatible type inferencing and parsing tools for those packages. You might consider `minty` to be 1.5e parsing engine.\n\n## Installation\n\nYou can install the development version of minty like so:\n\n``` r\nif (!require(\"remotes\")){\n    install.packages(\"remotes\")\n}\nremotes::install_github(\"gesistsa/minty\")\n```\n\n## Example\n\nA character-only data.frame\n\n```{r}\ntext_only \u003c- data.frame(maybe_age = c(\"17\", \"18\", \"019\"),\n                        maybe_male = c(\"true\", \"false\", \"true\"),\n                        maybe_name = c(\"AA\", \"BB\", \"CC\"),\n                        some_na = c(\"NA\", \"Not good\", \"Bad\"),\n                        dob = c(\"2019/07/21\", \"2019/08/31\", \"2019/10/01\"))\nstr(text_only)\n```\n\n```{r}\n## built-in function type.convert:\n## except numeric, no type inferencing\nstr(type.convert(text_only, as.is = TRUE))\n```\n\nInferencing the column types\n\n```{r}\nlibrary(minty)\ndata \u003c- type_convert(text_only)\ndata\n```\n\n```{r}\nstr(data)\n```\n\n### Type-based parsing tools\n\n```{r}\nparse_datetime(\"1979-10-14T10:11:12.12345\")\n```\n\n```{r}\nfr \u003c- locale(\"fr\")\nparse_date(\"1 janv. 2010\", \"%d %b %Y\", locale = fr)\n```\n\n```{r}\nde \u003c- locale(\"de\", decimal_mark = \",\")\nparse_number(\"1.697,31\", local = de)\n```\n\n```{r}\nparse_number(\"$1,123,456.00\")\n```\n\n```{r}\n## This is perhaps Python\nparse_logical(c(\"True\", \"False\"))\n```\n\n### Type guesser\n\n```{r}\nparse_guess(c(\"True\", \"TRUE\", \"false\", \"F\"))\n```\n\n```{r}\nparse_guess(c(\"123.45\", \"1990\", \"7619.0\"))\n```\n\n```{r}\nres \u003c- parse_guess(c(\"2019-07-21\", \"2019-08-31\", \"2019-10-01\", \"IDK\"), na = \"IDK\")\nres\n```\n\n```{r}\nstr(res)\n```\n\n## Differences: `readr` vs `minty`\n\nUnlike `readr` and `vroom`, please note that `minty` is mainly for **non-interactive usage**. Therefore, `minty` emits fewer messages and warnings than `readr` and `vroom`.\n\n```{r}\ndata \u003c- minty::type_convert(text_only)\ndata\n```\n\n```{r}\ndata \u003c- readr::type_convert(text_only)\ndata\n```\n\n`verbose` option is added if you like those messages, default to `FALSE`. To keep this package as minimal as possible, these optional messages are printed with base R (not `cli`).\n\n```{r}\ndata \u003c- minty::type_convert(text_only, verbose = TRUE)\n```\n\nAt the moment, `minty` does not use [the `problems` mechanism](https://vroom.r-lib.org/reference/problems.html) by default.\n\n```{r}\nminty::parse_logical(c(\"true\", \"fake\", \"IDK\"), na = \"IDK\")\n```\n\n```{r}\nreadr::parse_logical(c(\"true\", \"fake\", \"IDK\"), na = \"IDK\")\n```\n\nSome features from `vroom` have been ported to `minty`, but not `readr`.\n\n```{r}\n## tidyverse/readr#1526\nminty::type_convert(data.frame(a = c(\"NaN\", \"Inf\", \"-INF\"))) |\u003e str()\n```\n\n```{r}\nreadr::type_convert(data.frame(a = c(\"NaN\", \"Inf\", \"-INF\"))) |\u003e str()\n```\n\n`guess_max` is available for `parse_guess()` and `type_convert()`, default to `NA` (same as `readr`).\n\n```{r}\nminty::parse_guess(c(\"1\", \"2\", \"drei\"))\n```\n\n```{r}\nminty::parse_guess(c(\"1\", \"2\", \"drei\"), guess_max = 2)\n```\n\n```{r}\nreadr::parse_guess(c(\"1\", \"2\", \"drei\"))\n```\n\nFor `parse_guess()` and `type_convert()`, `trim_ws` is considered before type guessing (the expected behavior of `vroom::vroom()` / `readr::read_delim()`).\n\n```{r}\nminty::parse_guess(c(\"   1\", \" 2 \", \" 3  \"), trim_ws = TRUE)\n```\n\n```{r}\nreadr::parse_guess(c(\"   1\", \" 2 \", \" 3  \"), trim_ws = TRUE)\n```\n\n```{r}\n##tidyverse/readr#1536\nminty::type_convert(data.frame(a = \"1 \", b = \" 2\"), trim_ws = TRUE) |\u003e str()\n```\n\n```{r}\nreadr::type_convert(data.frame(a = \"1 \", b = \" 2\"), trim_ws = TRUE) |\u003e str()\n```\n\n## Similar packages\n\nFor parsing ambiguous date(time)\n\n* [timeless](https://github.com/schochastics/timeless)\n* [anytime](https://github.com/eddelbuettel/anytime)\n\nGuess column types of a text file\n\n* [hdd](https://CRAN.R-project.org/package=hdd)\n\n## Acknowledgements\n\nThanks to:\n\n* The [Tidyverse Team](https://github.com/tidyverse) for allowing us to spin off the code from `readr`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgesistsa%2Fminty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgesistsa%2Fminty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgesistsa%2Fminty/lists"}