Hence Knowledge Repo
  • Home
  1. Machine Learning / Engenharia
  2. R Packages Development Guide
  • Processos
    • Gestão de Projetos
    • Padrões Hence
    • Ask Issues
    • Reproducible R scripts
  • Credito / Modelagem
    • Crédito Imobiliário - Métricas de Perda
    • Modelo de Crédito Imobiliário (Quod)
    • Probabilidade de recuperação de crédito usando análise de sobrevivência
    • Tutorial Análise de sobrevivencia
    • Advanced Survival Modelling for Consumer Credit
    • IFRS 9 (Book: Tiziano Bellini)
  • Machine Learning / Engenharia
    • Feature Engineering (Max Kuhn)
    • Machine Learning Engineering
    • NLP
    • R Packages Development Guide
    • Functional Programming Workshop
  • Relatorios
    • Recuperação de crédito e Perda Esperada - Direcional Taxas

On this page

  • 1 R Packages Development Guide
  1. Machine Learning / Engenharia
  2. R Packages Development Guide

1 R Packages Development Guide

  • Make sure you’ve installed not only R, but also the R development tools. For example, on Ubuntu (and Debian) you need to install the r-base-dev package.

  • Verify system prep: devtools::dev_sitrep()

  • lapply(.libPaths(), list.dirs, recursive = FALSE, full.names = FALSE)

  • the main levers that control which libraries are active, in order of scope and persistence:

    • Environment variables, like R_LIBS and R_LIBS_USER, which are consulted at startup.

    • Calling .libPaths() with one or more filepaths.

    • Executing small snippets of code with a temporarily altered library search path via withr::with_libpaths().

    • Arguments to individual functions, like install.packages(lib =) and library(lib.loc =).

  • library() should NEVER be used inside a package.

  • Package name:

    • The name can only consist of letters, numbers, and periods, i.e., ..

    • It must start with a letter.

    • It cannot end with a period.

    We recommend against using periods in package names, due to confusing associations with file extensions and S3 methods.

  • Pragmatic advice:

    • Pick a unique name that’s easy to Google.

    • Don’t pick a name that’s already in use on CRAN or Bioconductor.

    • Avoid using both upper and lower case letters: doing so makes the package name hard to type and even harder to remember.

    • Give preference to names that are pronounceable, so people are comfortable talking about your package and have a way to hear it inside their head.

    • Find a word that evokes the problem and modify it so that it’s unique.

    • Use abbreviations: Rcpp, brms (Bayesian Regression Models using Stan)

    • Add an extra R: stringr, beepr

    • Don’t get sued.

    • Naming Packages

    • So, you’ve decided to change your r package name

    • Use the available package:

      • Checks for validity.

      • Checks availability on CRAN, Bioconductor, and beyond.

      • Searches various websites to help you discover any unintended meanings. In an interactive session, the URLs you see above are opened in browser tabs.

      • Attempts to report whether name has positive or negative sentiment.