This is an R package containing shortcut utility functions commonly used by B. Staton in his R code, and most other packages he's written will import the needed version by default. It can be installed from R as follows:
devtools::install_packages("bstaton1/StatonMisc")
Note that you must have the devtools
package installed first.
Example functions include:
-
ext_device()
which creates a new graphics window using the operating system-specific graphics function. For example, if the user is using a PC, the effect is the same as callingwindows()
or if on a Mac, the effect is the same as callingquartz()
-
cv2sig()
andsig2cv()
, which are opposite transformations of one another and are used to convert back and forth between the standard deviation and the coefficient of variation of a lognormal random variable -
doy2date()
anddate2doy()
, which are also opposites. They convert numbers back and forth from 1-365 (or 366 if a leap year) to MM/DD/YYYY format -
beta_mm()
, which is used to calculate the shape parameters of a beta distribution when passed a vector of assumed i.i.d. beta random variables using moment matching -
logit()
andexpit()
, which perform the logit and inverse-logit transformations, respectively -
%!in%
, which is the opposite of%in%
. Allows users to specifyx %!in% y
Rather than
!(x %in% y)
When determining which elements of the vector
x
are not found in the vectory
All functions have associated help files. Though it may seem like a silly package, it is the first one created by B. Staton and it's been used as a training exercise.
Bug fixes or suggested additions can be submitted via either issues or pull requests.