This function will populate the content of /src and /data directories for a specific coding club session, the date of which is passed as a parameter. Directories are created if needed. Files are downloaded if not already present.

setup_codingclub_session(
  session_date = format(Sys.Date(), "%Y%m%d"),
  root_dir = ".",
  src_rel_path = "src",
  data_rel_path = "data"
)

Arguments

session_date

The date of the coding-club session, in the "YYYYMMDD" format. Default: actual date

root_dir

Root directory where source and data subdirectories are located. Default: ./

src_rel_path

Relative path for R script(s). Default: src

data_rel_path

Relative path for data files. Default: data

Examples

if (FALSE) {
library(inborutils)

# Download coding club files for session 2020-02-25
# R script(s) in `./src/20200225` and data files in `./data/20200225`
setup_codingclub_session("20200225")

# Specify the folders where you want to save R files and data files
# R files will be downloaded in `./source`
# Data files will be downloaded in `./dataframes`
setup_codingclub_session(
  "20200225",
  src_rel_path = "source",
  data_rel_path = "dataframes"
)

# You can modify the root directory even if it should be normally not needed.
# For example you want to move the root to the parent directory, `../`
setup_codingclub_session("20200225",
  root_dir = "../",
  src_rel_path = "source",
  data_rel_path = "dataframes"
)
}