r-gregmisc/gtools

suggested additions

Opened this issue · 3 comments

Since gtools is very lightweight and already widely used, it seems like it would be a useful place to put small/lightweight utilities that are not already available in a lightweight package (i.e., they're either in a heavy package [lots of dependencies, compiled code ...] or only in blog posts etc.).

  • logspace addition/subtraction/summation etc. (in hmmTMB, matrixStats, also in base R C code and R.h as logspace_(add|sub|sum)
  • self-naming lists? lme4::namedList, tibble::lst()
  • array-melting (from reshape2::melt) is as.data.frame.table(x) so not necessary, but maybe a convenience/mnemonic wrapper (and an option to rename the value column)?

@arni-magnusson do you have any opinions about this (since we will have to submit a new version to CRAN in the near future to handle some small CRAN-compatibility issues anyway)?

Well, that's certainly the original spirit of gregmisc! An eclectic collection of nifty tools, mostly simple and stable tools.

I will always be a fan of tools with zero dependencies. Other criteria for adding to gtools, as you mention, could be general usefulness, maintainability, and not being already available in a lightweight CRAN package.

The original gregmisc was split into gdata, gmodels, gplots, and gtools. The gmodels and gplots show no signs of growing and gdata is actually shrinking, but if gtools feels like growing, it definitely should :)

FWIW I submitted a bug report/enhancement request for R - I think it would be better to expose the existing C code rather than create yet another implementation ... (although adding it to gtools would allow it to be used with older versions of R ...)