to_subdir_matrix: Convert a Vector of Paths to a Matrix of Subfolders

Description Usage Arguments Value Examples

View source: R/to_subdir_matrix.R

Description

Convert a Vector of Paths to a Matrix of Subfolders

Usage

1
2
3
4
5
6
7
to_subdir_matrix(
  paths,
  fill.value = "",
  result_type = "matrix",
  dbg = FALSE,
  method = NA_integer_
)

Arguments

paths

vector of path strings

fill.value

value used to fill empty cells of the result matrix

result_type

one of c("matrix", "data.frame", "list"), specifying the type of object to be returned. Result type "list" is only implemented for method = 2.

dbg

if TRUE debug messages are shown

method

integer specifying the implementation method. Currently not used.

Value

matrix or data frame, depending on result_type

Examples

1
2
3
4
5
6
7
folder_matrix <- kwb.file::to_subdir_matrix(c("a1/b1/c1", "a1/b2", "a2"))

folder_matrix

dim(folder_matrix)

folder_matrix[folder_matrix[, 1] == "a1", ]

KWB-R/kwb.file documentation built on Dec. 31, 2021, 8:15 p.m.