{"id":13470285,"url":"https://poissonconsulting.github.io/term/","last_synced_at":"2025-03-26T11:31:22.339Z","repository":{"id":36577249,"uuid":"194526636","full_name":"poissonconsulting/term","owner":"poissonconsulting","description":"An R package to manipulate the names of parameters terms","archived":false,"fork":false,"pushed_at":"2025-01-22T00:50:19.000Z","size":2685,"stargazers_count":10,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-22T18:01:52.015Z","etag":null,"topics":["coefficients","cran","mcmc","r","rstats","term"],"latest_commit_sha":null,"homepage":"https://poissonconsulting.github.io/term/","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/poissonconsulting.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":".github/SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-30T14:40:49.000Z","updated_at":"2025-01-22T00:50:22.000Z","dependencies_parsed_at":"2025-01-14T19:21:55.230Z","dependency_job_id":"cfccc318-b70f-4beb-bb9f-a256615f489d","html_url":"https://github.com/poissonconsulting/term","commit_stats":{"total_commits":479,"total_committers":8,"mean_commits":59.875,"dds":"0.17954070981210857","last_synced_commit":"2391eb9eec62a6c45944e33c317cd6ece5167576"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poissonconsulting%2Fterm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poissonconsulting%2Fterm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poissonconsulting%2Fterm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poissonconsulting%2Fterm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/poissonconsulting","download_url":"https://codeload.github.com/poissonconsulting/term/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245644291,"owners_count":20649170,"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":["coefficients","cran","mcmc","r","rstats","term"],"created_at":"2024-07-31T16:00:27.699Z","updated_at":"2025-03-26T11:31:17.326Z","avatar_url":"https://github.com/poissonconsulting.png","language":"R","funding_links":[],"categories":["Compound"],"sub_categories":["[term](https://poissonconsulting.github.io/term/)"],"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# term \u003cimg src=\"man/figures/logo.png\" align=\"right\" /\u003e\n\n\u003c!-- badges: start --\u003e\n[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)\n[![R-CMD-check](https://github.com/poissonconsulting/term/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/poissonconsulting/term/actions/workflows/R-CMD-check.yaml)\n[![Codecov test coverage](https://codecov.io/gh/poissonconsulting/term/graph/badge.svg)](https://app.codecov.io/gh/poissonconsulting/term)\n[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)\n[![CRAN status](https://www.r-pkg.org/badges/version/term)](https://cran.r-project.org/package=term)\n![CRAN downloads](http://cranlogs.r-pkg.org/badges/term)\n\u003c!-- badges: end --\u003e\n\n`term` is an R package to create, manipulate, query and repair vectors of parameter terms.\nParameter terms are the labels used to reference values in vectors, matrices and arrays.\nThey represent the names in coefficient tables and the column names in \n`mcmc` and `mcmc.list` objects.\n\n## Installation \n\nTo install the latest release from [CRAN](https://cran.r-project.org)\n```{r, eval=FALSE}\ninstall.packages(\"term\")\n```\n\nTo install the developmental version from [GitHub](https://github.com/poissonconsulting/term)\n```{r, eval=FALSE}\n# install.packages(\"remotes\")\nremotes::install_github(\"poissonconsulting/term\")\n```\n\n## Demonstration\n\n### Term Vectors\n```{r}\nlibrary(term)\n\n# term vectors are the labels used to reference values in\n# vectors, matrices and arrays\nterm \u003c- term(\n  \"alpha[1]\", \"alpha[2]\", \"beta[1,1]\", \"beta[2,1]\",\n  \"beta[1,2]\", \"beta[2,2]\", \"sigma\"\n)\n\n# they print like character vectors\nterm\n\n# but are S3 class objects that also inherit from vctrs_vctr\nclass(term)\n```\n\n```{r}\n# consider a matrix of term values\nset.seed(101)\nestimate \u003c- matrix(rnorm(4), nrow = 2)\nestimate\n\n# the term labels can be created using as_term()\nterm \u003c- as_term(estimate, name = \"b0\")\nterm\n\n# and combined with the term values to create a coef table\nlibrary(tibble)\ncoef \u003c- tibble(term = term, estimate = as.vector(estimate))\ncoef\n```\n\n### Querying Term Vectors\n```{r}\n# the term vectors are readily sorted\ncoef[rev(order(coef$term)), ]\n\n# and the parameter names or parameter dimensions extracted\nterm \u003c- term(\n  \"alpha[1]\", \"alpha[2]\", \"beta[1,1]\", \"beta[2,1]\",\n  \"beta[1,2]\", \"beta[2,2]\", \"sigma\"\n)\n\npars(term)\npdims(term)\n\n# this can also be done for each term\npars_terms(term)\ntindex(term)\n```\n\n### Validating Term Vectors\n```{r}\n# term vectors can be tested for whether they have (parseably) valid,\n# (dimensionally) consistent and complete terms.\n\n# valid terms\nvalid_term(term(\"a\", \"a[1]\", \"a [2]\", \" b [3  ] \", \"c[1,10]\"))\n\n# invalid terms\nvalid_term(new_term(c(\"a a\", \"a[]\", \"a[2\", \" b[3 3]\", \"c[1,10]c\")))\n\n# consistent terms\nconsistent_term(term(\"a\", \"a[2]\", \"b[1,1]\", \"b[10,99]\"))\n\n# inconsistent terms\nconsistent_term(term(\"a\", \"a[2,1]\", \"b[1,1]\", \"b[10,99,1]\"))\n\n# complete terms\nis_incomplete_terms(term(\"a\", \"a[2]\", \"b[1,1]\", \"b[2,1]\"))\n\n# incomplete terms\nis_incomplete_terms(term(\"a\", \"a[3]\", \"b[1,1]\", \"b[2,2]\"))\n```\n\n### Checking Term Vectors\n\n```{r, error=TRUE}\n# term vectors can be checked using functions styled on those in the chk package\nx \u003c- term(\"a[1]\", \"a[3]\")\nvld_term(x, validate = \"valid\")\nchk_term(x, validate = \"complete\")\n```\n\n### Repairing Term Vectors\n\n```{r error = TRUE}\nterm \u003c- new_term(c(\"b[4]\", \"b   [2]\", \"b\", \"b[1\", \"b[2, 2]\", \"b\", \"a [ 1 ] \", NA))\nterm\n\n# valid terms can be repaired (invalid terms are converted to missing values)\nterm \u003c- repair_terms(term)\nterm\n\n# the `term()` constructor rejects invalid terms\nterm(\"b[4]\", \"b   [2]\", \"b\", \"b[1\", \"b[2, 2]\", \"b\", \"a [ 1 ] \", NA)\n\n# missing values can easily removed\nterm \u003c- term[!is.na(term)]\nterm\n\n# and only unique values retained\nterm \u003c- unique(term)\nterm\n\n# a term vector can be sorted by parameter name and index\nterm \u003c- sort(term)\nterm\n\n# an inconsistent term removed\nterm \u003c- term[term != \"b[2,2]\"]\nterm\n\n# and incomplete terms completed\nterm \u003c- sort(complete_terms(term))\nterm\n```\n\n## Contribution\n\nPlease report any [issues](https://github.com/poissonconsulting/term/issues).\n\n[Pull requests](https://github.com/poissonconsulting/term/pulls) are always welcome.\n\n## Code of Conduct\n\nPlease note that the term project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html).\nBy contributing to this project, you agree to abide by its terms.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/poissonconsulting.github.io%2Fterm%2F","html_url":"https://awesome.ecosyste.ms/projects/poissonconsulting.github.io%2Fterm%2F","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/poissonconsulting.github.io%2Fterm%2F/lists"}