xref: /aosp_15_r20/external/rappor/analysis/R/util.R (revision 2abb31345f6c95944768b5222a9a5ed3fc68cc00)
1#!/usr/bin/Rscript
2#
3# Common utility library for all R scripts.
4
5# Log message with timing.  Example:
6#
7# _____ 1.301 My message
8#
9# The prefix makes it stand out (vs R's print()), and the number is the time so
10# far.
11#
12# NOTE: The shell script log uses hyphens.
13
14Log <- function(...) {
15  cat(sprintf('_____ %.3f ', proc.time()[['elapsed']]))
16  cat(sprintf(...))
17  cat('\n')
18}
19