aboutsummaryrefslogtreecommitdiff
path: root/analysis/R/util.R
blob: 7fa75fe1113deefbca123e6928fce52f08cf24dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/Rscript
#
# Common utility library for all R scripts.

# Log message with timing.  Example:
#
# _____ 1.301 My message
#
# The prefix makes it stand out (vs R's print()), and the number is the time so
# far.
#
# NOTE: The shell script log uses hyphens.

Log <- function(...) {
  cat(sprintf('_____ %.3f ', proc.time()[['elapsed']]))
  cat(sprintf(...))
  cat('\n')
}