/usr/share/doc/r-cran-r.utils/tests/MultiVerbose.R is in r-cran-r.utils 2.5.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | library("R.utils")
# Output to both standard output and to log file
stdoutLog <- Verbose(threshold=-1)
fileLog <- Verbose("foo.log", threshold=-1)
verbose <- MultiVerbose(list(stdoutLog, fileLog), threshold=-1)
header(verbose, "A verbose writer example", padding=0)
enter(verbose, "Analysis A")
for (kk in 1:10) {
printf(verbose, "step %d\n", kk)
if (kk == 2) {
cat(verbose, "Turning ON automatic timestamps")
timestampOn(verbose);
} else if (kk == 4) {
timestampOff(verbose);
cat(verbose, "Turned OFF automatic timestamps")
cat(verbose, "Turning OFF verbose messages for steps ", kk, "-6")
off(verbose)
} else if (kk == 6) {
on(verbose)
cat(verbose, "Turned ON verbose messages just before step ", kk+1)
}
if (kk %in% c(5,8)) {
enter(verbose, "Sub analysis ", kk)
for (jj in c("i", "ii", "iii")) {
cat(verbose, "part ", jj)
}
exit(verbose)
}
}
cat(verbose, "All steps completed!")
exit(verbose)
ruler(verbose)
cat(verbose, "Demo of some other methods:")
str(verbose, c(a=1, b=2, c=3))
print(verbose, c(a=1, b=2, c=3))
summary(verbose, c(a=1, b=2, c=3))
evaluate(verbose, rnorm, n=3, mean=2, sd=3)
ruler(verbose)
newline(verbose)
|