This function retrieves a YRBS dataset by year, creates a directory if needed, and saves it in the specified format.

save_raw_data(
  year,
  format = "csv",
  dest_dir = "downloaded_raw_data",
  load = TRUE,
  ...
)

Arguments

year

Numeric. The year of YRBS data to retrieve (e.g., 2017).

format

Character. The format to save the data: "csv", "spss", "parquet", or "rds".

dest_dir

Character. Destination directory to store the file (default: "downloaded_raw_data").

load

Logical. Whether to load the dataset into R (TRUE) or just save it (FALSE).

...

Additional arguments passed to the respective saving functions.

Value

If load = TRUE, returns the dataset. Otherwise, returns the file path invisibly.