R/to_subdir_matrix.R
to_subdir_matrix.RdConvert a Vector of Paths to a Matrix of Subfolders
to_subdir_matrix(
paths,
fill.value = "",
result_type = "matrix",
dbg = FALSE,
method = NA_integer_
)vector of path strings
value used to fill empty cells of the result matrix
one of c("matrix", "data.frame", "list"),
specifying the type of object to be returned. Result type "list" is only
implemented for method = 2.
if TRUE debug messages are shown
integer specifying the implementation method. Currently not used.
matrix or data frame, depending on result_type
folder_matrix <- kwb.file::to_subdir_matrix(c("a1/b1/c1", "a1/b2", "a2"))
folder_matrix
#> [,1] [,2] [,3]
#> [1,] "a1" "b1" "c1"
#> [2,] "a1" "b2" ""
#> [3,] "a2" "" ""
dim(folder_matrix)
#> [1] 3 3
folder_matrix[folder_matrix[, 1] == "a1", ]
#> [,1] [,2] [,3]
#> [1,] "a1" "b1" "c1"
#> [2,] "a1" "b2" ""