Description Usage Arguments Details Value Examples
View source: R/compress.logs.R
Compress log files and optionally remove them to save space and make simulation results more portable
1 2 3 4 5 6 7 8 9 |
path.results |
The path to the 'Results' folder |
scenarios |
A character vector with the scenarios to be processed or "all" |
delete.log |
whether the log file should be deleted |
overwrite.gz |
if a .gz file with the same name is present, should it be overwritten? |
compression |
compression rate, integer between 0 and 9. See
|
parallel |
whether execute the function in parallel |
ncores |
the number of cores if executed in parallel |
From (very limited) testing, a compression of 1 gives substantial compression
(about 23% of original size) and it is very fast. compression=7
gives
almost the max compression (~18.5% of the original size) taking ~ 4 times
longer than compression=1
. Anything beyon 7 takes much longer but with
a gain of only a 0.1% or less.
Note that it makes sense to execute this function in parallel only if a solid
state disk (SSD) is available. If ncores
is left to its default
(NULL
) and parallel=TRUE
all available processors will be used.
a list where the first element is the list of log files found and the second is the gz files created
1 2 3 4 5 6 7 8 9 | # Create a temp directory
tmp <- tempdir()
dir.create(file.path(tmp, "test"))
# Create a fake log file
cat(file=file.path(tmp, "test", "foo.log"), "Hello world!")
# Compress the log file
compress.logs(path.results=tmp, scenarios="test", delete.log=TRUE, overwrite.gz=TRUE)
# clean up
unlink(tmp, recursive=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.