utilities {utilitiesR} | R Documentation |
This contains a set of utilities I find myself using quite often within R. They tend to be functions a developer would use more than a standard user.
Files
There are a number of functions to create file names,
directories, etc. There is also an extension of
file.choose
.
Debugging
A number of functions for debugging:
verbosePrint
which is essentially a wrapper
around cat
;
verbosePrintf
which is basically
sprintf
except that it also prints
its output; evaluate
, being shorthand for
eval(parse(text=...))
, and so on;
Coordinates
This also contains a number of functions for converting between GPS and UTM. It is arguable whether they should be in here, but I use them often enough that they are.
The function UTM2GPS
and its inverse
GPS2UTM
rely on either the PROJ executable
being in the user's $PATH (ie uses a system call), or the
rgdal package being installed.
The PROJ / system call method is in there because it is often easier to install this on linux ("proj-bin" in Ubuntu) than it is to install the rgdal package.
However, on Windows, the rgdal package is quite easy to install, and so that is the more common method of coordinate conversion on that platform.
Hence these functions are just wrappers around those.
Maths
Finally, there are a few maths functions in there for
convenience: make2Drot
simply makes a 2x2
rotation matrix (I can never remember the formula
myself); euclidDist
calculates the
euclidian distance between successive rows/columns of a
matrix (again just a syntactic suggar);
sortPointsRectangle
sorts the vertices of a
rectangle into an anticlockwise fashion (TODO: extend to
sort vertices of any convex polygon).