Saves the study's state in tflplanner's home (the copy
open_study() reads; the one before goes to its history), then writes
the study folder from it: the definition workbooks in spec/ (with
output_path and program_dir set to the study's own folders), the
report programs, autoexec_report.R, programs/study_setup.R (made
when missing; otherwise its tflplanner part only, see
study_setup_code()), and study.yml. The programs
are the definition's: each is written from it whenever it changes. One
edited by hand since (its banner's checksum no longer matches) is
written again too, its edited copy first put in programs/.edited/
(named after its place and the time) – what it changed belongs in the
definition (the data code, a user-code report, a custom analysis,
where / derive).
Usage
save_study(
study,
home = tflplanner_home(),
base = NULL,
spec = c("check", "overwrite")
)Arguments
- study
An
rtfstudy.- home
tflplanner's home.
- base
The study as it was opened (or last saved) by whoever saves now. Given it, the save merges: a part (the study fields, the report list, each sheet, each sheet of the ARD definition ...) this person did not change keeps what is saved now – someone else may have changed it – and a part both changed differently is a conflict that stops the save (class
tflplanner_conflict).The definition files are the study's source (#274): a save never writes over one changed outside tflplanner since it last wrote or read them. Such a save stops (class
tflplanner_spec_changed, itsfilesthe files changed): open the study again, orreload_from_spec(), to take the files in; or write them back from the last save (write_spec()).- spec
"check"(the default) stops when a definition file was changed outside tflplanner;"overwrite"writes over it, after copying it tospec/.rejected/(whatwrite_spec()does).