example_files {basepenguins}R Documentation

List or find example files from basepenguins package

Description

These functions provides access to example files included with the basepenguins package. When example_files() is called with path = NULL, it lists available example files. When called with a specific path, it returns the full path to that file. example_dir() provides the path to the directory containing the examples, and also takes a copy.dir argument which, if specified, will copy all the example files to a new directory. This is useful for testing the convert_dir_inplace() and convert_files_inplace() functions without overwriting package files.

Usage

example_files(path = NULL, full.names = FALSE, recursive = TRUE)

example_dir(copy.dir = NULL)

Arguments

path

Character string. If NULL (default), lists all available example files. If specified, returns the full path to the specified file or directory.

full.names

Logical. If TRUE, returns full file paths rather than relative paths. Only used when path = NULL. Default is FALSE.

recursive

Logical. If TRUE, lists files in subdirectories recursively. Only used when path = NULL. Default is TRUE.

copy.dir

Character string. A directory name or path to a directory into which the files in the example directory will be copied. If NULL (default) the files will not be copied.

Details

There are four example files in the example directory:

Value

example_files:

example_dir:

Examples

# List all files in the example directory provided by the package
example_files()

# Get the full path to a specific example files
example_files("penguins.R") # path/to/basepenguins/extdata/penguins.R
example_files("nested/penguins.qmd")

# Get the path to the directory containing the example files
example_dir() # path/to/basepenguins/extdata/

# Copy all files in the example directory
example_dir(".") # copy example files into working directory
example_dir("examples") # create subdirectory



[Package basepenguins version 0.1.0 Index]