R functions for hydrologic modeling