Nothing
#===========================================================
# Export Randomization Schedule
#===========================================================
#' Export Randomization Schedule
#'
#' Export a randomization schedule to a CSV file.
#'
#' @param schedule A data frame or tibble generated by ExpDesignR.
#' @param file Character. Output CSV filename or path. This argument
#' must be supplied explicitly.
#' @param row.names Logical. Should row names be written?
#'
#' @return Invisibly returns the input \code{schedule} unchanged.
#' The function writes the schedule to the CSV file specified by
#' \code{file}.
#'
#' @examples
#' sch <- simple_randomization(
#' n = 20,
#' groups = c("Control", "Treatment"),
#' seed = 123
#' )
#'
#' tf <- tempfile(fileext = ".csv")
#'
#' export_schedule(
#' sch,
#' file = tf
#' )
#'
#' unlink(tf)
#'
#' @importFrom utils write.csv
#' @export
export_schedule <- function(
schedule,
file,
row.names = FALSE
) {
if (!is.data.frame(schedule)) {
stop(
"'schedule' must be a data frame.",
call. = FALSE
)
}
if (
!is.character(file) ||
length(file) != 1L ||
is.na(file) ||
!nzchar(file)
) {
stop(
"'file' must be a single non-empty character string.",
call. = FALSE
)
}
utils::write.csv(
schedule,
file = file,
row.names = row.names
)
message(
"Schedule exported to: ",
normalizePath(
file,
winslash = "/",
mustWork = FALSE
)
)
invisible(schedule)
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.