dpjr_data: Get file path to data files

View source: R/dpjr_data.R

dpjr_dataR Documentation

Get file path to data files

Description

dpjr comes bundled with various data files in its 'inst/extdata' directory. This function make them easy to access.

Usage

dpjr_data(path = NULL)

Arguments

path

Name of file in quotes with extension; for example '"mpg.csv"' will work. If 'NULL', the example files will be listed.

Source

This function is adapted from 'readxl::readxl_example()' and 'palmerpenguins::path_to_file'.

Examples

# return a list of all the files in the package
dpjr_data()
#
# return the full path of the named file
dpjr_data("mpg.csv")
#
# return the head (first 6 rows) of the named file
head(read.csv(dpjr_data("mpg.csv")))

MonkmanMH/dpjr documentation built on Aug. 9, 2024, 5:44 p.m.