Nothing
#' Round to multiple of any number.
#
#' @param x numeric or date-time (POSIXct) vector to round
#' @param accuracy number to round to; for POSIXct objects, a number of seconds
#' @param f rounding function: \code{\link{floor}}, \code{\link{ceiling}} or
#' \code{\link{round}}
#' @source adapted from `plyr`
#' @export
#' @examples
#' round_any(1.865, accuracy = .25)
round_any <- function(x, accuracy, f = round) {
UseMethod("round_any")
}
#' @export
round_any.numeric <- function(x, accuracy, f = round) {
f(x / accuracy) * accuracy
}
#' @export
round_any.POSIXct <- function(x, accuracy, f = round) {
tz <- format(x[1], "%Z")
xr <- round_any(as.numeric(x), accuracy, f)
as.POSIXct(xr, origin = "1970-01-01 00:00.00 UTC", tz = tz)
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.