#' A wrapper function of \code{\link[TIPC]{count_TIPC_cat}}
#'
#' A wrapper function to run \code{\link[TIPC]{count_TIPC_cat}} at various
#' hexagonal lengths.
#'
#' @param root_dir A directory path pointing to the parent directory of all the
#' ouptput folders generated by \code{\link[TIPC]{tessellation}} at various
#' hexagonal lengths.
#' @param hex_len_range A vector of 2 integer number indicating the range of
#' hexagonal length. If unspecified (NULL), all found result folders generated
#' by \code{\link[TIPC]{tessellation}} will be processed.
#' @param hex_len_stepsize An integer indicating the step size of hexagonal
#' length. If unspecified (NULL), all found result folders generated
#' by \code{\link[TIPC]{tessellation}} will be processed.
#' @export
multiple_hexLen_count_TIPC_cat <- function(root_dir = NULL,
hex_len_range = NULL, hex_len_stepsize = 10){
## ======================
## identify all result folders generated by tessellation
## ======================
subfolder_nms <- list.dirs(path = root_dir, full.names = TRUE, recursive = FALSE)
## subsetting for output folders from tessellation
subfolder_nms <- grep(x= subfolder_nms, pattern = 'TIPC_hexLen', value = TRUE)
## ======================
## subsettting for result folders specified by users
## ======================
if (!is.null(hex_len_range) & length(hex_len_range)>1) {
hex_lens <- seq(from = min(hex_len_range), to = max(hex_len_range),
by = hex_len_stepsize)
subfolder_nms <- grep(x = subfolder_nms, pattern = paste0(hex_lens,
collapse = "|"), value = TRUE)
}else if(!is.null(hex_len_range) & length(hex_len_range)==1) {
hex_lens <- hex_len_range
subfolder_nms <- grep(x = subfolder_nms, pattern = paste0(hex_lens,
collapse = "|"), value = TRUE)
}
## ======================
## calling count_TIPC_cat at individual hex_len
## ======================
for (hex_lenX in subfolder_nms){
count_TIPC_cat(root_dir = hex_lenX)
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.