R/add_to_file.R

Defines functions add_to_file

Documented in add_to_file

#' @title Add text to a file.
#' 
#' @description Adds the given text to the chosen file.
#' 
#' @author Briac LE RAY (briac.leray@partnre.com)
#' 
#' @return Does not return anything.
#' @param text The text to be added. Type = character
#' @param file_path The path to the file you want to write in. Type = character
#' @param append Do you want to append (TRUE) or erase (FALSE), default is TRUE. Type = logical
#' @examples add_to_file(text = "I want this text in my file.", file_path = "/path/to/the/file/file_name.extension", append = TRUE)

add_to_file <- function(text, file_path, append = TRUE) {
  write(x = paste(text, "\n"), file = file_path, append = append)
}
Tiipiac/StressTestOptimization documentation built on Dec. 18, 2021, 5:08 p.m.