gtools-1.5.1
Release update. New commands, major features, and various bug fixes. Remember to run gtools, upgrade to keep up to date between major updates.
New Commands
-
gstats winsoris a fast, by-ablewinsor2alternative for Winsorizing and trimming data (accepts weights). -
greshape longandgreshape wideare a fast alternative to reshape. -
greshape spreadandgreshape gatherare analogous to thespreadandgathercommands from R'stidyr. -
gstats sumandgstats tab(aliasgstats summarizeandgstats tabstat) are a fast, by-able alternative tosum, detailandtabstat
Enhancements and Features
-
gstats sumorgstats tabwith optionmatasave; this stores the output and by levels inGstatsOutput(custom naming viamatasave(name)), an object of classGtoolsResults. -
gcollapseandgegennow allow the stats:select#andselect-#, for the#th smallest or largest value, respectively.rawselect#andrawselect-#, ibid but ignoring weights.cv, coefficient of variation,sd/meanvariancerange,max-min
-
greshapefeatures- Preferred syntax is
by()andkeys()instead ofi()andj(); the docs and most of the printouts reflect this. greshapetries to save variable labels, notes, and characteristics when reshaping.greshape, uselabelsallows the user to save the source variable labels as levels instead of their names.greshapesupports @ syntax.greshape wideadditionally supports varlist syntax (but the same stub cannot have both@and a varlist).greshape longdoes not support varlist syntax, but the user can pass regexes as stubs with the optionmatch(regex). See the documentation for details.
- Preferred syntax is
-
glevelsofandgtopfeaturesglevelsofandgtopboth take optionmatasave(ormatasave(name)) to save the variable levels in a mata object (default name isGtoolsByLevels).- With option
matasave[(name)],r(levels)is not returned; the levels are stored inprintedas part of the mata return object (e.g.GtoolsByLevels.printed). The user can save only the raw levels by also adding thesilentoption. - With option
matasave[(name)], bothgtop, numfmt()andglevelsof, numfmt()do the number formatting in mata, sonumfmt()must pass a mata print format instead of a C print format (they are very similar, however). - With option
matasave[(name)],gtopdoes not returnr(toplevels)either. The frequency table is stored intoplevelsas part of the mata return object (e.g.GtoolsByLevels.toplevels). gtop, ntop(.)prints all the levels from largest to smallest;gtop, ntop(-.)prints from smallest to largest;gtop, alphaprints the largest/smallestntop()levels sorted in variable order (e.g. alphabetically or numerically, depending on the variable type).gtopalso storesr(ntop),r(nrows), andr(alpha)as return scalars; ifntop(.)orntop(-.)are passed,r(ntop)will just ber(J).- Both
gtopandglevelsofshould handle embedded characters better. Printing is still a problem but they get copied to the return values properly.
-
gstatsis a general-purpose wrapper for misc functions. -
lgtools.mlibadded with come pre-compiled mata functios. -
Any function that allows results to be saved in mata allow the mata object to call
.desc()to get more info on the object. -
Faster hash sort with integer bijection (two-pass radix sorts for smaller integers; undocumented option
_ctolerance()allows the user to force the regular counting sort). -
Faster index copy when every observation is read (simply assign the index pointer to
st_info->index)
Bug Fixes
-
Stata 14.0 no longer tries to load SPI version 3 (loads version 2).
-
SpookyHash code compiled directly as part of the plugin. Might fix #35 (deleted all ancillary files and code related to
spookyhash.dll). -
gtop,glevelsof, andgcontractparse wildcards before adding any temporary variables, ensuring the latter don't get included in internal function calls. -
Removed locale as a dependency; comma printing done manually. This fixes a bug where in certain systems, locale would get reset and cause some internal Stata numbers fo interpret decimals via comma, that is,
95.0would become95,0and cause problems down the line. -
Minor bug fix in
gtop; inverted levels were not correctly sorted with weights. The levels themselves were OK, however. -
gcollapseno longer crashes whenrawstatdoes not match any entries.