R/write_hit_matrix_to_csv.R

Defines functions write_hit_matrix_to_csv

Documented in write_hit_matrix_to_csv

#' Writes hit matrix to csv for further analysis
#'
#' \code{write_hit_matrix_to_csv} writes hit matrix to .csv for further analysis
#'
#' This is a specific function that writes the output variables to disk in .csv format
#' @param m matrix of VAI with z and x coordinates
#' @param outputname name of file currently being processed
#' @param output_directory directory where output goes
#' @keywords hit matrix
#'
#'
#' @examples
#' \dontrun{
#' # This function runs internally.
#' write_hit_matrix_to_csv(m, outputname, output_directory)
#' }

write_hit_matrix_to_csv <- function(m, outputname, output_directory) {
  m.og <- m
  m <- m[, c("xbin", "zbin", "vai")]

  #Write just thie hit matrix
  filename2 <- paste(outputname, "_hit_matrix.csv", sep="")
  utils::write.csv(m, file.path(output_directory, filename2))

  #full matrix
  filename3 <- paste(outputname, "_full_matrix.csv", sep = "")
  utils::write.csv(m.og, file.path(output_directory, filename3))

}
atkinsjeff/forestr documentation built on Nov. 29, 2017, 3:18 a.m.