assertions-file: Useful test related to files

Description Usage Arguments Examples

Description

Useful test related to files

Usage

1
2
3
4
5
6
7
is.dir(path)

is.writeable(path)

is.readable(path)

has_extension(path, ext)

Arguments

path

a file path to examine

ext

extension to test for (has_extension only)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14

Example output

[1] FALSE
attr(,"msg")
[1] "path is not a string (a length one character vector)."
[1] FALSE
attr(,"msg")
[1] "Path '/work/tmp/tmp/Rtmpxd6Iaa/file62264968ac89' does not exist"
[1] FALSE
attr(,"msg")
[1] "Path '/work/tmp/tmp/Rtmpxd6Iaa/file62264968ac89' does not exist"
[1] TRUE
[1] FALSE
attr(,"msg")
[1] "Path '/work/tmp/tmp/Rtmpxd6Iaa/file62264968ac89' is not a directory"
[1] TRUE
[1] TRUE
[1] FALSE
attr(,"msg")
[1] "Path '/work/tmp/tmp/Rtmpxd6Iaa/file62264968ac89' does not exist"

assertthat documentation built on May 1, 2019, 10:25 p.m.