Create Random File Paths Using English Words
random_paths( max_depth = 5, min_chars = 5, max_elements = 10, depth_to_leaf_weight = function(depth) 1.2^depth )
max_depth | maximum path depth |
---|---|
min_chars | least number of characters per folder or file name |
max_elements | maximum number of elements (files or subfolders) in a folder |
depth_to_leaf_weight | function that calculates a weight from the given path depth. The weight is used to increase the probability of a folder element to be a file and not a subdirectory. By default the weight is calculated by 1.2^depth, i.e. for a folder in depth 10 it is about six times (1.2^10 = 6.19) more probable of its elements to be files instead of subfolders |
# Make this example reproducible set.seed(12059) # Create random paths paths <- kwb.pathdict::random_paths(max_depth = 5) # Show the random paths paths#> [1] "plane/position/plain/natural.R" #> [2] "plane/position/plain/heard.jpg" #> [3] "plane/position/symbol.pdf" #> [4] "plane/position/again/thank/locate.xls" #> [5] "plane/position/again/thank/guess.doc" #> [6] "plane/position/again/thank/pretty.R" #> [7] "plane/position/again/thank/occur/except.R" #> [8] "plane/position/again/thank/occur/children.doc" #> [9] "plane/position/again/thank/occur/suggest.doc" #> [10] "plane/position/again/thank/occur/nature.png" #> [11] "plane/position/again/thank/occur/order.jpg" #> [12] "plane/position/again/thank/occur/triangle.doc" #> [13] "plane/position/again/thank/occur/process.doc" #> [14] "plane/position/again/reason/century.pdf" #> [15] "plane/position/again/colony/period.jpg" #> [16] "plane/position/again/afraid.R" #> [17] "plane/position/again/quotient.png" #> [18] "plane/position/sleep/measure.doc" #> [19] "plane/position/sleep/continue.jpg" #> [20] "plane/position/sleep/meant.R"#> Splitting paths ... ok. (0.00s)#> #> 3 4 5 6 #> 1 7 5 7