write.design {designr} | R Documentation |
Write Design Files
Description
This function writes a design into a set of files. For each random factor, a unit list is created that contains a list of all levels (instances) of the random factor and the factor levels to which that level is assigned. Moreover, code_files are created that contain a complete set of experimental codes.
Usage
write.design(
design,
group_by = NULL,
order_by = NULL,
randomize = FALSE,
run_files = paste0("run", ifelse(length(group_by) > 0L, paste0("_", group_by, "-%",
seq_along(group_by), "$s", collapse = ""), "")),
code_files = "codes_%s",
output_dir,
output_handler,
file_extension = NULL,
...
)
write.design.csv(..., quote = FALSE, row.names = FALSE)
write.design.xlsx(..., format_headers = FALSE)
write.design.json(..., dataframe = "columns")
Arguments
design |
The |
group_by |
Experimental codes are to be grouped by these factors. If |
order_by |
The experimental codes are to be ordered by these columns. Also see |
randomize |
After ordering, lines in the same order rank are to be shuffled randomly if set to |
run_files |
The pattern to be used for the file names of the run_files (i.e., files containing the experimental codes). By default, file names are |
code_files |
Code files (files containing conditions for levels of random factors) are named after this pattern. |
output_dir |
All files are written into this directory. |
output_handler |
This is the function that is called to write the data frames. If using |
file_extension |
This is the file_extension to be added after each file name. Use ” if no file_extension is to be added. If 'NULL', the file_extension is guessed from the output_handler used. |
... |
Other parameters to be passed on to |
quote , row.names |
|
format_headers |
see |
dataframe |
Functions
-
write.design.csv()
: Using default settings for writing CSV files -
write.design.xlsx()
: Using default settings for writing XLSX files (using thewritexl
package) -
write.design.json()
: Using default settings for writing JSON files (using thejsonlite
package)
See Also
output.design
for use of order_by
and group_by
.
Examples
des <- fixed.factor("Factor1", c("1A","1B")) +
fixed.factor("Factor2", c("2A","2B")) +
random.factor("Subject", c("Factor1"))
# This writes a CSV file for each subject and a CSV list of subjects
write.design(des, group_by = "Subject", output_handler = write.csv, output_dir = tempdir())
# This writes a single CSV file for all subjects and a CSV list of subjects
write.design(des, output_handler = write.csv, output_dir = tempdir())