Learn R Programming

assertthat (version 0.2.1)

assertions-file: Useful test related to files

Description

Useful test related to files

Usage

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

Run this code
# NOT RUN {
see_if(is.dir(1))

tmp <- tempfile()
see_if(file.exists(tmp))
see_if(is.dir(tmp))

writeLines("x", tmp)
see_if(file.exists(tmp))
see_if(is.dir(tmp))
see_if(is.writeable(tmp))
see_if(is.readable(tmp))
unlink(tmp)

see_if(is.readable(tmp))
# }

Run the code above in your browser using DataLab