Package 'pathlist'

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

Help Index


Provide Names for Autocomplete after Dollar

Description

Provide Names for Autocomplete after Dollar

Usage

## S3 method for class 'pathlist'
.DollarNames(x, pattern)

Arguments

x

object

pattern

patterm matching possible completions


Filter Paths by Index

Description

Filter Paths by Index

Usage

## S4 method for signature 'pathlist'
x[i]

Arguments

x

object of class pathlist

i

indices in the vector of paths


Filter Paths by Top Level Folder

Description

Filter Paths by Top Level Folder

Usage

## S4 method for signature 'pathlist'
x$name

Arguments

x

object of class pathlist

name

name of top level folder


Character Representation of a pathlist Object

Description

Character Representation of a pathlist Object

Usage

## S4 method for signature 'pathlist'
as.character(x, relative = FALSE)

Arguments

x

a pathlist object

relative

if TRUE (the default is FALSE) the root is omitted from the paths


List Representation of a pathlist Object

Description

List Representation of a pathlist Object

Usage

## S4 method for signature 'pathlist'
as.list(x, relative = FALSE)

Arguments

x

a pathlist object

relative

if TRUE (the default is FALSE) the root is omitted from the paths


Matrix Representation of a pathlist Object

Description

Matrix Representation of a pathlist Object

Usage

## S4 method for signature 'pathlist'
as.matrix(x, relative = FALSE)

Arguments

x

a pathlist object

relative

if TRUE (the default is FALSE) the root is removed from the paths


Get the File Path Depths

Description

Get the File Path Depths

Usage

depth(object)

Arguments

object

object of class pathlist


Get the File Path Depths

Description

Get the File Path Depths

Usage

## S4 method for signature 'pathlist'
depth(object)

Arguments

object

object of class pathlist


Get the File Name Only

Description

Get the File Name Only

Usage

filename(object)

Arguments

object

object of class pathlist


Get the File Name Only

Description

Get the File Name Only

Usage

## S4 method for signature 'pathlist'
filename(object)

Arguments

object

object of class pathlist


Get the File Name Only

Description

Get the File Name Only

Usage

folder(object)

Arguments

object

object of class pathlist


Get the Folder Path of all Folders Below the Top-Level

Description

Get the Folder Path of all Folders Below the Top-Level

Usage

## S4 method for signature 'pathlist'
folder(object)

Arguments

object

object of class pathlist


Guess and Set the Declared Encodings

Description

Guess and Set the Declared Encodings

Usage

guess_and_set_declared_encodings(x)

Arguments

x

vector of character

Examples

Encoding("\xe4")
Encoding(guess_and_set_declared_encodings("\xe4"))

First Paths in pathlist

Description

First Paths in pathlist

Usage

## S4 method for signature 'pathlist'
head(x, n = 6)

Arguments

x

object of class pathlist

n

number of paths


Hide the Server Name in the Root

Description

Hide the Server Name in the Root

Usage

hide_server(object)

Arguments

object

object of class pathlist


Hide the Server Name in the Root

Description

Hide the Server Name in the Root

Usage

## S4 method for signature 'pathlist'
hide_server(object)

Arguments

object

object of class pathlist


Number of Paths in pathlist

Description

Number of Paths in pathlist

Usage

## S4 method for signature 'pathlist'
length(x)

Arguments

x

object of class pathlist


Class to Work with File Paths

Description

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

Description

Print a pathlist Object

Usage

## S4 method for signature 'pathlist'
show(object)

Arguments

object

a pathlist object


Print Path Summary

Description

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

Usage

## S4 method for signature 'pathlist'
summary(object)

Arguments

object

object of class pathlist


Last Paths in pathlist

Description

Last Paths in pathlist

Usage

## S4 method for signature 'pathlist'
tail(x, n = 6)

Arguments

x

object of class pathlist

n

number of paths


Get the Top-Level Folder

Description

Get the Top-Level Folder

Usage

toplevel(object)

Arguments

object

object of class pathlist


Get the Top-Level Folder

Description

Get the Top-Level Folder

Usage

## S4 method for signature 'pathlist'
toplevel(object)

Arguments

object

object of class pathlist