This function reads a CSV or similarly formatted data file located in the package's
`inst/extdata/` directory. It safely constructs the file path and returns the content
as a data frame.
Usage
read_data_file(filename, sep = ",")
Arguments
- filename
Character string. The name of the file to read, including extension (e.g., `"mydata.csv"`).
- sep
Character string. The field separator used in the file. Defaults to `","`.
Value
A data frame containing the data read from the specified file.
Details
This function is useful for accessing example datasets or reference tables shipped within
the package without requiring users to manually specify full file paths.
It verifies the file exists inside the package before attempting to read it.
Examples
if (FALSE) { # \dontrun{
df <- read_data_file("countries_continent_region.csv", sep = ";")
} # }