Skip to contents

Plot Distributions of Files in Folder Depths and Name Summaries

Usage

plot_file_distribution(file_data, start_path, n_root_parts, ..., to_pdf = TRUE)

Arguments

file_data

data frame with columns path, type, size

start_path

only paths from file_data are considered that start with this path

n_root_parts

number of first path segments to be considered as "root"

...

further arguments passed to kwb.fakin:::plot_file_size_in_depth

to_pdf

if TRUE (default) the results are plotted into a temporary pdf file that is opened in a pdf viewer

Examples

# Set a seed for the random number generator
set.seed(20190625)

# Create random paths
paths <- kwb.pathdict::random_paths()

# Number of paths
n <- length(paths)

# Create artificial file data (invent sizes)
file_data <- kwb.utils::noFactorDataFrame(
  path = paths,
  type = "file",
  size = abs(rnorm(n)) * kwb.fakin:::bytes_to_mib(
    2^sample(30, n, replace = TRUE)
  )
)

kwb.fakin::plot_file_distribution(
  file_data, start_path = "reason", n_root_parts = 1, to_pdf = FALSE
)
#> Splitting paths ... ok. (0.00s) 
#> Warning: no non-missing arguments to min; returning Inf
#> Splitting paths ... ok. (0.00s) 
#> Warning: no non-missing arguments to max; returning -Inf
#> Warning: no non-missing arguments to min; returning Inf
#> Putting path segments together ... ok. (0.00s) 
#> Warning: no non-missing arguments to max; returning -Inf
#> list()