Description Usage Arguments Author(s) References See Also Examples
Turns a character
object denoting a directory path into an object
of class RappFilesystemDirectory3
.
1 | asDirectoryPath(path = ".", ensure = FALSE, strict = FALSE, ...)
|
path |
Signature argument. Object containing path information. |
ensure |
|
strict |
|
... |
Further arguments passed to:
|
Janko Thyson janko.thyson@rappster.de
https://github.com/Rappster/filesystr
asDirectoryPath-character-method,
ensureDirectory
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 47 48 49 50 51 52 53 | ## Not run:
##------------------------------------------------------------------------------
## Method: character
##------------------------------------------------------------------------------
## Path //
path_0 <- file.path(tempdir(), "path")
res <- asDirectoryPath(path = path_0)
res
class(res)
## Strict:
try(asDirectoryPath(path = path_0, strict = TRUE))
## --> error as 'path' does not exist yet
path <- tempfile()
file.create(path)
try(asDirectoryPath(path = path, strict = TRUE))
## --> error as 'path' is a file and not a directory
## Note that 'ensure' overrules 'strict':
asDirectoryPath(path = path_0, ensure = TRUE, strict = TRUE)
file.exists(path_0)
## Clean up //
conditionalDelete(path = path_0, condition = tempdir())
##------------------------------------------------------------------------------
## Method: DirectoryPath.S3
##------------------------------------------------------------------------------
## Path //
path_0 <- file.path(tempdir(), "path2")
res <- asDirectoryPath(path = asDirectoryPath(path_0))
res
class(res)
## Strict:
try(res <- asDirectoryPath(path = asDirectoryPath(path_0), strict = TRUE))
## --> error as 'path' does not exist yet
## Note that 'ensure' overrules 'strict':
asDirectoryPath(path = asDirectoryPath(path_0), ensure = TRUE, strict = TRUE)
file.exists(path_0)
## Clean up //
conditionalDelete(path = path_0, condition = tempdir())
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.