R/create_file_nltt_stats.R

Defines functions create_nltt_stats_file

Documented in create_nltt_stats_file

#' @title Creates file containing nltt stats
#' @description Creates file containing nltt stats
#' @inheritParams default_params_doc
#' @return the name of the saved file
#' @author Giovanni Laudanno
#' @aliases create_file_nltt_stats create_nltt_stats_file
#' @export create_file_nltt_stats create_nltt_stats_file
create_file_nltt_stats <- create_nltt_stats_file <- function(
  project_folder_name = getwd()
) {

  # create the dataframe
  nltt_stats <- collect_nltt_stats(project_folder_name) # nolint internal function

  # save output
  results_folder <- get_results_path(project_folder_name) # nolint

  # No warning if folder already exists
  dir.create(results_folder, showWarnings = FALSE)

  nltt_stats_filename <- file.path(
    results_folder,
    "nltt_stats.csv"
  )
  utils::write.csv(x = nltt_stats, file = nltt_stats_filename)

  # return file name
  nltt_stats_filename
}
richelbilderbeek/razzo documentation built on March 10, 2021, 1:17 p.m.