Description Usage Arguments Author(s) References See Also Examples
Turns a character object denoting a file path into an object
of class FilePath.S3.
| 1 | asFilePath(path = ".", ensure = FALSE, strict = FALSE, ...)
 | 
| path | Signature argument. Object containing file path information. | 
| ensure | 
 | 
| strict | 
 | 
| ... | Further arguments of:
 | 
Janko Thyson janko.thyson@rappster.de
https://github.com/Rappster/filesystr
| 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 | ## Not run: 
##------------------------------------------------------------------------------
## Method: character
##------------------------------------------------------------------------------  
  
## Path //
path_0 <- file.path(tempdir(), "path/test.txt")
res <- asFilePath(path = path_0)
res
class(res)
## Strict:
try(asFilePath(path = path_0, strict = TRUE))
## --> error as 'path' does not exist yet
try(asFilePath(path = tempdir(), strict = TRUE))
## --> error as 'path' is a directory and not a file 
## Note that 'ensure' overrules 'strict':
asFilePath(path = path_0, ensure = TRUE, strict = TRUE)
file.exists(path_0)
## Clean up //
conditionalDelete(path = path_0, condition = tempdir())
##------------------------------------------------------------------------------
## Method: FilePath.S3
##------------------------------------------------------------------------------
## Path //
path_0 <- file.path(tempdir(), "path/test2.txt")
res <- asFilePath(path = asFilePath(path_0))
res
class(res)
## Strict:
try(res <- asFilePath(path = asFilePath(path_0), strict = TRUE))
## --> error as 'path' does not exist yet
## Note that 'ensure' overrules 'strict':
asFilePath(path = asFilePath(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.