assert_all_are_empty_files
From assertive.files v0.0-2
by Richard Cotton
Is a file too big or small?
Checks to see if a file is within a given size range.
Usage
assert_all_are_empty_files(x, severity = getOption("assertive.severity", "stop"))
assert_any_are_empty_files(x, severity = getOption("assertive.severity", "stop"))
assert_all_are_non_empty_files(x, severity = getOption("assertive.severity", "stop"))
assert_any_are_non_empty_files(x, severity = getOption("assertive.severity", "stop"))
assert_all_file_sizes_are_in_range(x, lower = 0, upper = Inf, lower_is_strict = FALSE, upper_is_strict = FALSE, na_ignore = FALSE, severity = getOption("assertive.severity", "stop"))
assert_any_file_sizes_are_in_range(x, lower = 0, upper = Inf, lower_is_strict = FALSE, upper_is_strict = FALSE, severity = getOption("assertive.severity", "stop"))
is_empty_file(x, .xname = get_name_in_parent(x))
is_non_empty_file(x, .xname = get_name_in_parent(x))
is_file_size_in_range(x, lower = 0, upper = Inf, lower_is_strict = FALSE, upper_is_strict = FALSE, .xname = get_name_in_parent(x))
Arguments
- x
- Input to check.
- severity
- How severe should the consequences of the assertion be?
Either
"stop"
,"warning"
,"message"
, or"none"
. - lower
- Smallest file size allowed, in bytes.
- upper
- Largest file size allowed, in bytes.
- lower_is_strict
- If
TRUE
, the lower bound is open (strict) otherwise it is closed. - upper_is_strict
- If
TRUE
, the upper bound is open (strict) otherwise it is closed. - na_ignore
- A logical value. If
FALSE
,NA
values cause an error; otherwise they do not. Likena.rm
in many stats package functions, except that the position of the failing values does not change. - .xname
- Not intended to be used directly.
Value
is_empty_file
wraps file.info
, retuning TRUE
when the input is a file that exists with size zero.
assert_*_are_empty_files
return nothing but throws an error if
is_empty_file
returns FALSE
.
See Also
Examples
library(assertive.files)
tf <- tempfile()
file.create(tf)
is_empty_file(tf)
cat("some stuff", file = tf)
is_non_empty_file(tf)
assertive.base::dont_stop(assert_all_file_sizes_are_in_range(tf, lower = 100))
unlink(tf)
Community examples
Looks like there are no examples yet.