Title: | Package Supporting the Work with File Paths |
---|---|
Description: | This package implements a S4 class pathlist that internally stores a vector of file paths (as, e.g. received with dir()) as a matrix of path segments. I found out that this is the most compact form to store the paths. The main feature of the class is the dollar function that allows to filter paths for the value of their top-level folder. Using the dollar operator subsequently you can easily narrow down the list of paths. The class implements functions length(), head(), tail(), summary(), and show(). |
Authors: | Hauke Sonnenberg |
Maintainer: | Hauke Sonnenberg <[email protected]> |
License: | Apache License 2.0 |
Version: | 0.2.1 |
Built: | 2024-11-11 03:02:45 UTC |
Source: | https://github.com/hsonne/pathlist |
Provide Names for Autocomplete after Dollar
## S3 method for class 'pathlist' .DollarNames(x, pattern)
## S3 method for class 'pathlist' .DollarNames(x, pattern)
x |
object |
pattern |
patterm matching possible completions |
Filter Paths by Index
## S4 method for signature 'pathlist' x[i]
## S4 method for signature 'pathlist' x[i]
x |
object of class pathlist |
i |
indices in the vector of paths |
Filter Paths by Top Level Folder
## S4 method for signature 'pathlist' x$name
## S4 method for signature 'pathlist' x$name
x |
object of class pathlist |
name |
name of top level folder |
Character Representation of a pathlist Object
## S4 method for signature 'pathlist' as.character(x, relative = FALSE)
## S4 method for signature 'pathlist' as.character(x, relative = FALSE)
x |
a pathlist object |
relative |
if |
List Representation of a pathlist Object
## S4 method for signature 'pathlist' as.list(x, relative = FALSE)
## S4 method for signature 'pathlist' as.list(x, relative = FALSE)
x |
a pathlist object |
relative |
if |
Matrix Representation of a pathlist Object
## S4 method for signature 'pathlist' as.matrix(x, relative = FALSE)
## S4 method for signature 'pathlist' as.matrix(x, relative = FALSE)
x |
a pathlist object |
relative |
if |
Get the File Path Depths
depth(object)
depth(object)
object |
object of class pathlist |
Get the File Path Depths
## S4 method for signature 'pathlist' depth(object)
## S4 method for signature 'pathlist' depth(object)
object |
object of class pathlist |
Get the File Name Only
filename(object)
filename(object)
object |
object of class pathlist |
Get the File Name Only
## S4 method for signature 'pathlist' filename(object)
## S4 method for signature 'pathlist' filename(object)
object |
object of class pathlist |
Get the File Name Only
folder(object)
folder(object)
object |
object of class pathlist |
Get the Folder Path of all Folders Below the Top-Level
## S4 method for signature 'pathlist' folder(object)
## S4 method for signature 'pathlist' folder(object)
object |
object of class pathlist |
Guess and Set the Declared Encodings
guess_and_set_declared_encodings(x)
guess_and_set_declared_encodings(x)
x |
vector of character |
Encoding("\xe4") Encoding(guess_and_set_declared_encodings("\xe4"))
Encoding("\xe4") Encoding(guess_and_set_declared_encodings("\xe4"))
First Paths in pathlist
## S4 method for signature 'pathlist' head(x, n = 6)
## S4 method for signature 'pathlist' head(x, n = 6)
x |
object of class pathlist |
n |
number of paths |
Hide the Server Name in the Root
hide_server(object)
hide_server(object)
object |
object of class pathlist |
Hide the Server Name in the Root
## S4 method for signature 'pathlist' hide_server(object)
## S4 method for signature 'pathlist' hide_server(object)
object |
object of class pathlist |
Number of Paths in pathlist
## S4 method for signature 'pathlist' length(x)
## S4 method for signature 'pathlist' length(x)
x |
object of class pathlist |
This class simplifies the work with file paths. Paths are internally stored as a matrix of subfolders with one row per file and one column per path depth level. You can use the Dollar operator to filter for paths belonging to a certain top folder.
Print a pathlist Object
## S4 method for signature 'pathlist' show(object)
## S4 method for signature 'pathlist' show(object)
object |
a pathlist object |
This function prints a summary of a vector of file paths giving the common root of all paths, the number of paths, the maximum path depth, the number of paths within each depth and the names of the ten top level folders that are biggest in terms of number of contained files
## S4 method for signature 'pathlist' summary(object)
## S4 method for signature 'pathlist' summary(object)
object |
object of class pathlist |
Last Paths in pathlist
## S4 method for signature 'pathlist' tail(x, n = 6)
## S4 method for signature 'pathlist' tail(x, n = 6)
x |
object of class pathlist |
n |
number of paths |
Get the Top-Level Folder
toplevel(object)
toplevel(object)
object |
object of class pathlist |
Get the Top-Level Folder
## S4 method for signature 'pathlist' toplevel(object)
## S4 method for signature 'pathlist' toplevel(object)
object |
object of class pathlist |