{"id":32199423,"url":"https://github.com/corradolanera/depigner","last_synced_at":"2026-03-07T02:02:39.408Z","repository":{"id":51911265,"uuid":"113204901","full_name":"CorradoLanera/depigner","owner":"CorradoLanera","description":"Utilities for _pigna_ stuffs","archived":false,"fork":false,"pushed_at":"2023-04-24T00:22:40.000Z","size":897,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-08T15:55:48.238Z","etag":null,"topics":["hmisc","pigne","r","r-package","rms","telegram"],"latest_commit_sha":null,"homepage":"https://corradolanera.github.io/depigner/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CorradoLanera.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-12-05T16:15:54.000Z","updated_at":"2024-07-19T02:43:27.000Z","dependencies_parsed_at":"2025-09-08T15:37:09.607Z","dependency_job_id":"30fc2272-be6c-442b-9e2b-1a7075caf62a","html_url":"https://github.com/CorradoLanera/depigner","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/CorradoLanera/depigner","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CorradoLanera%2Fdepigner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CorradoLanera%2Fdepigner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CorradoLanera%2Fdepigner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CorradoLanera%2Fdepigner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CorradoLanera","download_url":"https://codeload.github.com/CorradoLanera/depigner/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CorradoLanera%2Fdepigner/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280371890,"owners_count":26319523,"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-22T02:00:06.515Z","response_time":63,"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":["hmisc","pigne","r","r-package","rms","telegram"],"created_at":"2025-10-22T03:15:36.056Z","updated_at":"2025-10-22T03:15:38.442Z","avatar_url":"https://github.com/CorradoLanera.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\nbibliography: 'inst/bib/doc-pkg.bib'\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n# depigner [![](https://img.shields.io/badge/WEB site-click me-orange.svg)](https://corradolanera.github.io/depigner/) \u003cimg src=\"man/figures/logo.png\" align=\"right\" height=\"138.5\"/\u003e\n\nA utility package to help you deal with ***pigne***\n\n\u003c!-- badges: start --\u003e\n\n|                 |                                                                                                                                                   |                                                                                                                                                                  |                                                                                                                                                  |\n|:----------------|:-------------------------------------------------------------------------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------------------------------------------------------------------------------------:|:------------------------------------------------------------------------------------------------------------------------------------------------:|\n| **Development** |              [![Devel version](https://img.shields.io/badge/GitHub-0.9.1-blue.svg)](https://github.com/CorradoLanera/depigner)             |                      [![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html#maturing)                     | [![last commit](https://img.shields.io/github/last-commit/CorradoLanera/depigner.svg)](https://github.com/CorradoLanera/depigner/commits/master) |\n| **CRAN**        |                    [![CRAN status](https://www.r-pkg.org/badges/version/depigner)](https://cran.r-project.org/package=depigner)                   |                   [![downloads](http://cranlogs.r-pkg.org/badges/grand-total/depigner?color=blue)](https://cran.r-project.org/package=depigner)                  |           [![downloads](http://cranlogs.r-pkg.org/badges/last-month/depigner?color=blue)](https://cran.r-project.org/package=depigner)           |\n| **CI**          | [![R build status](https://github.com/CorradoLanera/depigner/workflows/R-CMD-check/badge.svg)](https://github.com/CorradoLanera/depigner/actions) | [![Coverage status](https://codecov.io/gh/CorradoLanera/depigner/branch/master/graph/badge.svg)](https://codecov.io/github/CorradoLanera/depigner?branch=master) |      [![code size](https://img.shields.io/github/languages/code-size/CorradoLanera/depigner.svg)](https://github.com/CorradoLanera/depigner)     |\n\n\u003c!-- badges: end --\u003e\n\n\u003e **Pigna** [*pìn'n'a*] is the Italian word for *pine cone*.^[You can find all the possible meanings of *pigna* [here](https://www.treccani.it/vocabolario/pigna/), and you can listen how to pronounce it [here](https://it.forvo.com/word/pigna/#it). Note: the Italian plural for \"pigna\" is \"pigne\" [*pìn'n'e*].] In jargon, it's used to identify something (like a task...) boring, banal, annoying, painful, frustrating and maybe even with a not so beautiful or rewarding result, just like the obstinate act of trying to challenge yourself in extracting pine nuts from a pine cone, provided that at the end you will find at least one inside it...\n\n```{r include = FALSE}\nknitr::opts_chunk$set(\n  eval     = TRUE,\n  collapse = TRUE,\n  comment  = \"#\u003e\"\n)\nlibrary(magrittr)\nlibrary(pander)\n```\n\n# Overview\n\nThis package aims to provide some useful functions to be used to solve small everyday problems of coding or analyzing data with R. The hope is to provide solutions to that kind of problems which would be normally solved using quick-and-dirty (ugly and maybe even wrong) patches.\n\n| Tools Category                           | Function(s)               | Aim                                                                      |\n|:-----------------------------------------|:--------------------------|:-------------------------------------------------------------------------|\n| [Harrell's verse](#harrells-verse-tools) | `tidy_summary()`          | *`pander`-ready* data frame from `Hmisc::summary()`                      |\n|                                          | `paired_test_continuous`  | Paired test for continuous variable into `Hmisc::summary`                |\n|                                          | `paired_test_categorical` | Paired test for categorical variable into `Hmisc::summary`               |\n|                                          | `adjust_p()`              | Adjusts P-values for multiplicity of tests at `tidy_summary()`           |\n|                                          | `summary_interact()`      | data frame of OR for interaction from `rms::lrm()`                       |\n|                                          | `htypes()`                | Will be your variables continuous or categorical in `Hmisc::describe()`? |\n| [Statistical](#statistical-tools)        | `ci2p()`                  | Get P-value form estimation and confidence interval                      |\n| [Programming](#programming-tools)        | `pb_len()`                | Quick set-up of a `progress::progress_bar()` progress bar                |\n|                                          | `install_pkg_set()`       | Politely install set of packages (topic-related sets at `?pkg_sets`)     |\n|                                          | `view_in_excel()`         | Open a data frame in Excel, even in the middle of a pipe chain, on interactive session only     |\n| [Development](#development-tools)        | `use_ui()`                | Activate `{usethis}` user interface into your own package                |\n|                                          | `please_install()`        | Politely ask the user to install a package                               |\n|                                          | `imported_from()`         | List packages imported from a package (which has to be installed)        |\n| [Telegram](#telegram-tools)              | `start_bot_for_chat()`    | Quick start of a `{telegram.bot}` Telegram's bot                         |\n|                                          | `send_to_telegram()`      | Unified wrapper to send *someRthing* to a Telegram chat                  |\n|                                          | `errors_to_telegram()`    | Divert all your error messages from the console to a Telegram chat       |\n| [Why not?!](#why-not)                    | `gdp()`                   | Do you have TOO much pignas in your back?! ... try this out ;-)          |\n\n# Installation\n\nYou can install the released version of `{depigner}` from [CRAN](https://CRAN.R-project.org) with:\n\n``` r\ninstall.packages(\"depigner\")\n```\n\nYou can install the development version from [GitHub](https://github.com/) calling:\n\n```{r, eval = FALSE}\n# install.packages(\"devtools\")\ndevtools::install_github(\"CorradoLanera/depigner\")\n```\n\nNext, you can attach it to your session by:\n\n```{r}\nlibrary(depigner)\n```\n\n# Provided Tools\n\n## Harrell's Verse Tools\n\n-   **`tidy_summary()`**: produces a data frame from the `summary()` functions provided by `{Hmisc}` [\\@R-Hmisc] and `{rms}` [\\@R-rms] packages ready to be `pander::pander()`ed [\\@R-pander].\n\nCurrently it is tested for method *reverse* only:\n\n```{r}\nlibrary(rms)\n  options(datadist = 'dd')\nlibrary(survival)\nlibrary(pander)\n\ndd \u003c- datadist(iris)\nmy_summary \u003c- summary(Species ~., data = iris, method = \"reverse\")\ntidy_summary(my_summary) %\u003e% \n  pander()\n\n\ndd \u003c\u003c- datadist(heart) # this to face a package build issue,\n                       # use standard `\u003c-` into analyses\nsurv \u003c- Surv(heart$start, heart$stop, heart$event)\nf    \u003c- cph(surv ~ age + year + surgery, data = heart)\nmy_summary \u003c- summary(f)\ntidy_summary(my_summary) %\u003e% \n  pander()\n```\n\n-   **`paired_test_*()`**: Paired test for categorical/continuous variables to be used in the `summary()` of the `{Hmisc}` [\\@R-Hmisc] package:\n\n```{r}\ndata(Arthritis)\n# categorical -------------------------\n## two groups\nsummary(Treatment ~ Sex,\n    data    = Arthritis,\n    method  = \"reverse\",\n    test    = TRUE,\n    catTest = paired_test_categorical\n)\n## more than two groups\nsummary(Improved ~ Sex,\n    data    = Arthritis,\n    method  = \"reverse\",\n    test    = TRUE,\n    catTest = paired_test_categorical\n)\n\n# continuous --------------------------\n## two groups\nsummary(Species ~.,\n    data    = iris[iris$Species != \"setosa\",],\n    method  = \"reverse\",\n    test    = TRUE,\n    conTest = paired_test_continuous\n)\n## more than two groups\nsummary(Species ~.,\n    data    = iris,\n    method  = \"reverse\",\n    test    = TRUE,\n    conTest = paired_test_continuous\n)\n```\n\n-   **`adjust_p()`**: Adjust P-values of a `tidy_summary` objects:\n\n```{r}\nmy_summary \u003c- summary(Species ~., data = iris,\n  method = \"reverse\",\n  test = TRUE\n)\n\ntidy_summary(my_summary, prtest = \"P\") %\u003e%\n  adjust_p()\n```\n\n-   **`summary_interact()`**: Produce a data frame of OR (with the corresponding CI95%) for the interactions between different combination of a continuous variable (for which it is possible to define the reference and the target values) and (every or a selection of levels of) a categorical one in a logistic model provided by `lrm()` (from the `{rms}` package [\\@R-rms]):\n\n```{r}\ndata(\"transplant\", package = \"survival\")\ncensor_rows \u003c- transplant[['event']] != 'censored' \ntransplant \u003c- droplevels(transplant[censor_rows, ])\n\ndd \u003c\u003c- datadist(transplant) # this to face a package build issue,\n                            # use standard `\u003c-` into analyses\n\nlrm_mod \u003c- lrm(event ~ rcs(age, 3)*(sex + abo) + rcs(year, 3),\n  data = transplant\n)\nsummary_interact(lrm_mod, age, abo) %\u003e%\n  pander()\n\nsummary_interact(lrm_mod, age, abo, p = TRUE) %\u003e%\n  pander()\n```\n\n-   **`htypes()`** and friends: get/check types of variable with respect to the `{Hmisc}` ecosystem [\\@R-Hmisc].\n\n```{r}\nhtypes(mtcars)\n\ndesc \u003c- Hmisc::describe(mtcars)\nhtypes(desc)\nhtype(desc[[1]])\nis_hcat(desc[[1]])\nis_hcon(desc[[1]])\n```\n\n## Statistical Tools\n\n-   **`ci2p()`**: compute the p-value related with a provided confidence interval:\n\n```{r}\nci2p(1.125, 0.634,\t1.999, log_transform = TRUE)\n```\n\n## Programming Tools\n\n-   **`pb_len()`**: Progress bar of given length, wrapper from the `{progress}` [\\@R-progress] package:\n\n```{r, eval=FALSE}\npb \u003c- pb_len(100)\n\nfor (i in 1:100) {\n    Sys.sleep(0.1)\n    tick(pb, paste(\"i = \", i))\n}\n```\n\n-   **`install_pkg_set()`**: Simple and polite wrapper to install sets of packages. Moreover, `{depigner}` provides some sets already defined for common scenario in R (analyses, production, documenting, ...). See them by call `?pgk_sets`.\n\n```{r, eval=FALSE}\ninstall_pkg_set() # this install the whole `?pkg_all`\ninstall_pkg_set(pkg_stan)\n\n?pkg_sets\n```\n\n-   **`view_in_excel()`**: A pipe-friendly function to view a data frame in Excel, optimal when used in the middle of a pipe-chain to see intermediate results. It works in interactive session only, so it is RMarkdown/Quarto friendly too!\n\n```{r, eval = FALSE}\nfour_cyl_cars \u003c- mtcars %\u003e%\n  view_in_excel() %\u003e%\n  dplyr::filter(cyl == 4) %\u003e%\n  view_in_excel()\n\nfour_cyl_cars\n```\n\n## Development Tools\n\n-   **`use_ui()`**: Use `{usethis}`' user interface [\\@R-usethis] in your package\n\n```{r, eval=FALSE}\n# in the initial setup steps of the development of a package\nuse_ui()\n```\n\n-   **`lease_install()`**: This is a polite wrapper to `install.packages()` inspired (= w/ very minimal modification) by a function Hadley showed us during a course.\n\n```{r, eval=FALSE}\na_pkg_i_miss \u003c- setdiff(available.packages(), installed.packages())[[1]]\nplease_install(a_pkg_i_miss)\n```\n\n-   **`imported_from()`**: If you would like to know which packages are imported by a package (eg to know which packages are required for its installation or either installed during it) you can use this function\n\n```{r}\nimported_from(\"depigner\")\n```\n\n## Telegram Tools\n\n-   **Wrappers to simple use of Telegram's bots**: wrappers from the `{telegram.bot}` package [\\@R-telegram.bot]:\n\n```{r, eval=FALSE}\n# Set up a Telegram bot. read `?start_bot_for_chat`\nstart_bot_for_chat()\n\n# Send something to telegram\nsend_to_telegram(\"hello world\")\n\nlibrary(ggplot2)\ngg \u003c- ggplot(mtcars, aes(x = mpg, y = hp, colour = cyl)) +\n    geom_point()\nsend_to_telegram(\n  \"following an `mtcars` coloured plot\",\n  parse_mode = \"Markdown\"\n)\nsend_to_telegram(gg)\n\n# Divert output errors to the telegram bot\nerrors_to_telegram()\n```\n\n## Why Not?!\n\n-   **`gdp()`**: A wrapper to relax\n\n```{r, eval=FALSE}\ngdp(7)\n```\n\n# Feature request\n\nIf you need some more features, please open an issue [here](https://github.com/CorradoLanera/depigner/issues).\n\n# Bug reports\n\nIf you encounter a bug, please file a [reprex](https://github.com/tidyverse/reprex) (minimal reproducible example) [here](https://github.com/CorradoLanera/depigner/issues).\n\n# Code of Conduct\n\nPlease note that the depigner project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.\n\n\u003c!--=================================================================--\u003e\n\n# Acknowledgements\n\nThe `{depigner}`'s logo was lovely designed by [Elisa Sovrano](https://www.elisasovrano.it).\n\n# Reference\n\n```{r bib, include=FALSE, eval = TRUE}\n# create a bib file for the R packages used in this document\nknitr::write_bib(\n  x    = c('rms', 'Hmisc', 'telegram.bot', 'progress', 'usethis',\n           'pander'),\n  file = 'inst/bib/doc-pkg.bib'\n)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcorradolanera%2Fdepigner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcorradolanera%2Fdepigner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcorradolanera%2Fdepigner/lists"}