Function Collection Related to Plotting and Hydrology
Draw horizontal histograms, color scattered points by 3rd dimension,
enhance date- and log-axis plots, zoom in X11 graphics, trace errors and warnings,
use the unit hydrograph in a linear storage cascade, convert lists to data.frames and arrays,
fit multiple functions.
Miscellaneous R functions. Notable: colPoints, horizHist, logAxis, pointZoom, smallPlot, lsc.
If direct installation from CRAN doesn't work, your R version might be too old. In that case, an update is really recommendable: r-project.org. If you can't update R, try installing from source (github) via instGit or devtools as mentioned above. If that's not possible either, here's a manual workaround:
click on Clone or Download - Download ZIP (top right, link), unzip the file to some place, then
setwd("that/path")
dd <- dir("berryFunctions-master/R", full=T)
dummy <- sapply(dd, source)
This creates all R functions as objects in your globalenv workspace (and overwrites existing objects of the same name!).
license
This package is under the GPL license.
I am fine with you doing whatever you want with it, provided that my name and credit remains attached to it.
If you legally need a more permissive license, let me know and I can probably change it.
News
berryFunctions
miscellaneous package by Berry Boessenkool, [email protected]
Any feedback is welcome, per email or on github.com/brry/berryFunctions
ToDo-list
textField: support srt. Enable positioning with xy.coords as in legend. expr=F if labels contain expression. Adjust adj parameter based on pos and offset: if(!is.null(pos)), I want the field to still be drawn with adj, but have it based on pos
implement is.error and getColumn (eg spiralDate) wherever applicable
reference to sortDF in addRow, insertRow, etc
colPoints: if z is matrix, use image/filled.contour/heatmap instead of points
colPointsLegend: improve text placement position for large/small legend fields
contemplate moving tryStack and traceCall to own package, maybe "trace"
Version 1.9.0 (2015-10-10)
To see all changes in detail, go to:
https://github.com/brry/berryFunctions/compare/[email protected]{2015-06-02}[email protected]{2015-10-10}
The general overview:
Package imports 'base' packages: graphics (22 functions used), stats (18), utils (6), grDevices (5)
Documentation updated in several places, notably in package info
ChangeLog renamed to NEWS, so that it shows up in package help index
combineFiles: progbar option added, with default options does no longer include outFile in outFile
climateGraph: rainfall sum corrected if compress=TRUE
movAv: NA handling greatly improved (some bugs went unnoticed for a long time)
linReg and mReg: handle NAs and formula input
linLogHist, linLogTrans: added sleep argument to slow down animation
pointZoom: expr argument added, colp renamed (col could not be given)
documentation improved and examples expanded in many places
where graphical parameters are changed, options are added to reset them (betaPlot, linLogTrans, normPLot, smallPlot, and in some example sections)
improvements in package-internal references to other functions (smoothLines eg now calls addAlpha, new functions repeatedly rely on existing functions)
linLogTrans: lots of new options, better transformation t values
logAxis: intermediate tick marks enabled
pretty2 can now be forced to return an exact nubmer of values
quantileMean: inputs checked, truncate option (analog to extremeStat::distLquantile), example with sample size dependency simulation
smallPlot: improved for mfrow situations, coordinates input and swapping improved, auomatic correction of input errors
New functions: panelDim, groupHist, monthAxis, pastec, linLogHist, movAvLines
removed: deprecatedFunctions
Version 1.7.1 (2014-12-20)
various small changes and bug fixes. See the commits on github
rmse and rsquare NA-removal warnings can now be silenced with quiet=TRUE
linReg: formula specification is now enabled: linReg(obj1~obj2) or linReg(col_a~col_b, data=df)
colPoints can now draw lines (with interpolation and with NA management) and triangles at legend ends for values outside Range
classify has new method logscaled and an index for values outside Range
textField: vertical extend of bounding boxes is now correct through use of expression
tableColVal: text can be changed (eg logarithmized, see examples)
createDoc: case now checked. Fixed handling when several args per line or explanations contain 'DEFAULT:'
logAxis: good internal range and base defaults. exponents. side can be a vector.
owa: replaced u with ellipsis. order of arguments is not changed anymore.
nameSample has been enhanced a lot.
tableColVal now uses classify
combineFiles now allows selection of lines
New functions: logSpaced, removeSpace, expReg, dupes
Version 1.6 (2014-10-14)
removed extremeStatLmom from this package (now in separate package extremeStat), updated package title and description
created a file with deprecated functions
version table removed from berryFunctions package documentation (redundant and outdated information)
Development version is now on Github
"cat" changed to "message" where applicable
mReg and exp4p documentation updated (minor changes)
logAxis expanded by log argument to draw the lines on log10(data) but without plot(log="x")
logAxis argument order improved (side at first place to mimic axis)
logAxis argument base has new default (1,2,5)
linReg now also writes rmse. The default line width and pch were changed
addAlpha now also takes a vector for alpha and yields elementwise alpha-ing
compareFiles and combineFiles have been renamed for consistency
seqR: added extendrange argument, rewrote part of the function
New functions: rainbow2, quantileMean, quantileBands, (compareFiles and combineFiles)
removed functions: extremeStatLmom, changeAttribute, showAttribute shapeZoom, (compFiles and combineTextfiles)
Version 1.5.2 (2014-09-15)
Functions to be moved to new packages warn about it (extremeStatLmom, changeAttribute, showAttribute and shapeZoom)
combineTextfiles gained 'names' argument to include filenames in the output
unitHydrograph: View() in examples only when interactive
nse, rmse, rqsuare: NA warning now gives numbers
New function: logAxis
Version 1.5 (2014-09-03)
To-Do-list centralized and sorted here, no to-Dos left in source code.
climateGraph: argument lists for each polygon with owa. sum and avg now at figure margins via mtext.
createDoc: extreme simplification of creation of usage section. Now creates new .Rd file if one already exists. Backslash handling optimized, but not perfect yet. Now allows latex in arg explanation, but the function start has to be indicated by a single { in an otherwise empty line. "fun" argument does not have to be in quotation marks anymore. Equal sign in defaults now handled correctly.
logVals: Default values for 'from' and 'to' changed
seqR: range is now first argument, so it doesn't have to be given each time. min and max argument "finite" changed to "na.rm".
tableColVal: argument lists for each text group, allowing srt etc.
owa: throws an understandable error when unnamed arguments are in the list
lsc: now warns when sum under UH is !=1. Calculation time Rcmd check in examples reduced. nse and rmse explicitly called from this package.
mReg: exp_4p outsourced, rsquare and rmse taken from package, R^2 is now calculated on the actual fit, not its linearization
require2 received the alias library2
colPoints, colPointsLegend: generally rewritten. classification methods, cpHist and smallPlot added.
extremeStatLmom: code for legend arguments improved (with owa)
packages lmom and spatstat were moved from "suggests" to "imports", as they are within functions and not just in the examples.
New functions: normPlot, betaPlot, exp4p, compFiles, funTinn, pretty2, colPointsHist, classify, smallPlot
functions removed: compareDoc (Rcmd check does this better, once a package is set up), extremeStat (replaced with extremeStatLmom)
Version 1.4 (2014-07-01)
Added To-Do list with my personal wishes (and some comments from other people) at the top of this ChangeLog. Examples in several functions received line breaks / shortening
extremeStatLmom: p.value by ks.test as measure for goodness of fit addded. Output is now data.frame instead of matrix. Value field in Doc is complemented. Examples are updated.
lsc: example QP-Data is now a file in the package folder extdata, not a dropbox link anymore (files were accidentally deleted and it was too slow anyways). P and Q labels are now placed in the outer margin.
mReg: ditto for temp data
New function: linLogTrans
Version 1.3 (2014-06-08)
Description field much more verbose
Shapefile (6 MB) removed from data
examples in changeAttribute, showAttribute, shapeZoom changed accordingly
Version 1.2 (2014-06-06)
email address in DESCRIPTION Maintainer Field (how could I possibly miss that typo?!) is now corrected.
This ChangeLog is now reformated to create a standard layout.
A lot of examples have received line breaks (they were longer than 100 chars).
berryFunctions-package: examples completed and grouped
createDoc: seealso extended.
funnelPLot and mReg: owa removed from function body
lsc: argument returnsim included, output now vector. psi incluced. catchment area included, examples and documentation updated
logVals: description updated
owa: programming example included, description changed.
combineTextfiles: example added.
require2: example is set to dontrun
Version 1.1 (2014-06-05)
First Version to be published
all functions have documentation.
Function names are standardized in lowerCamel.
Many of the already existing functions have been extended with more arguments and possibilities.
The following 3 functions have been removed:
info - use class or mode seperately
Rand - use box("figure")
vlast - use head() and tail()
unpublished, mainly just to try building a package
initial functions (Most of them had no or few documentation):
blines
bzoom
ci
cie
circle
colpoints
colpointslegend
distance
dreieckflaeche
extremSTAT
horiz.hist
info
link_google2pdf
linreg
monthlabs
movav
Rand
randompoints
shapezoom
vlast