Learn R Programming

⚠️There's a newer version (0.5.3) of this package.Take me there.

A dedicated Slack channel has been created for announcements, support and to help build a community of practice around this open source package. You may request an invitation to join from jonathan.callahan@dri.com.

MazamaCoreUtils

A suite of utility functions providing functionality commonly needed for 
production level projects such as logging, error handling, cache management and 
date-time parsing. Functions for date-time parsing and formatting require that 
timezones be specified explicitly, avoiding a common source of error when 
working with environmental time series.

Background

The MazamaCoreUtils package was created by MazamaScience to regularize our work building R packages, data processing pipelines and web services focused on environmental monitoring data.

The main goal of this package is to create an internally standardized set of functions that we can use in various systems that are being run operationally. Areas of functionality supported by this package include:

  • python style logging
  • simple error messaging
  • cache management
  • API key handling
  • date-time parsing and formatting
  • lat/lon validation and uniqueID creation
  • source code linting

Installation

Install from CRAN with:

install.packages('MazamaCoreUtils')

Install the latest version from GitHub with:

devtools::install_github('mazamascience/MazamaCoreUtils')


Development of this R package has been supported with funding from the following institutions:

Questions regarding further development of the package should be directed to jonathan.callahan@dri.edu.

Copy Link

Version

Install

install.packages('MazamaCoreUtils')

Monthly Downloads

508

Version

0.5.2

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Jonathan Callahan

Last Published

February 8th, 2024

Functions in MazamaCoreUtils (0.5.2)

logLevels

Log levels
packageCheck

Run package checks
logger.setup

Set up python-style logging
logger.error

Python-style logging statements
setAPIKey

Set APIKey
manageCache

Manage the size of a cache
logger.warn

Python-style logging statements
parseDatetime

Parse datetime strings
validateLonsLats

Validate longitude and latitude vectors
logger.isInitialized

Check for initialization of loggers
stopIfNull

Stop if an object is NULL
%>%

Pipe operator
validateLonLat

Validate longitude and latitude values
stopOnError

Error message generator
logger.setLevel

Set console log level
setIfNull

Set a variable to a default value if it is NULL
timezoneLintRules

Rules for timezone linting.
timeStamp

Character representation of a POSIXct
showAPIKeys

Show API keys
timeRange

Create a POSIXct time range
logger.trace

Python-style logging statements
tidyeval-data

Data pronoun for tidy evaluation
getAPIKey

Get API key
dateRange

Create a POSIXct date range
dateSequence

Create a POSIXct date sequence
MazamaCoreUtils

Utility Functions for Production R Code
createLocationID

Create one or more unique locationIDs
createLocationMask

Create a mask of valid locations
lintFunctionArgs

Lint a source file's function arguments
logger.debug

Python-style logging statements
initializeLogging

Initialize standard log files
logger.fatal

Python-style logging statements
html_getLinks

Find all links in an html page
loadDataFile

Load data from URL or local file
logger.info

Python-style logging statements
flog.layout

Manage logger layouts
flog.logger

Manage loggers
flog.appender

Manage appenders for loggers
html_getTables

Find all tables in an html page
APIKeys

API keys for data services.