main() will read the .toml files inside the project_path
and begin sourcing the strata and laminae in the order specified by the
user, with or without logging messages.
When a strata project is created main.R is added to the project root. This
script houses main(), and this file is the entry point to the project and
should be the target for automation. However, main() can be called from
anywhere, and users can opt to not use main.R at all.
.toml files
There are two types of .toml files that main() will read:
.strata.toml- a singular file inside the<project_path>/stratafolder.laminae.toml- a file inside each<project_path>/strata/<stratum_name>folderThese files are created by the
stratafunctions and are used to determine primarily the order of execution for the strata and laminae. Anything not referenced by a .toml will be ignored bymain()and other functions such assurvey_strata(),adhoc_stratum(), andadhoc_lamina(). Users can safely add other folders and files in the project root, and even within the subfolders and they will be ignored, unless users have code known by a.tomlthat references them.Users can use the functions
survey_tomls()and [view_toml())] to find and view the.tomlfiles in their project.
[view_toml())]: R:view_toml())
Examples
tmp <- fs::dir_create(fs::file_temp())
result <- strata::build_quick_strata_project(tmp, 1, 1)
main(tmp)
#> [2025-06-26 11:53:55.0544] INFO: Strata started
#> [2025-06-26 11:53:55.0550] INFO: Stratum: stratum_1 initialized
#> [2025-06-26 11:53:55.0554] INFO: Lamina: s1_lamina_1 initialized
#> [2025-06-26 11:53:55.0559] INFO: Executing: my_code
#> [1] "I am a placeholder, do not forget to replace me!"
#> [2025-06-26 11:53:55.0567] INFO: Strata finished - duration: 0.0025 seconds
fs::dir_delete(tmp)