Utilities

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(mintyr)

Small helpers: file-path parts with get_path_info(), and the example files shipped with the package.

Parts of file paths: get_path_info()

paths <- c("C:/Users/foo/Documents/report.xlsx",
           "/home/user/.bashrc",
           "relative/path/to/data.csv",
           ".hidden.tar.gz",
           NA_character_)

# Mode B: filename only, extension stripped (default)
get_path_info(paths)

# Mode B: filename only, extension preserved
get_path_info(paths, rm_extension = FALSE)

# Mode B: full normalised path, extension stripped
get_path_info(paths, rm_path = FALSE)

# Mode A: extract the 2nd path segment
get_path_info(paths, n = 2)

# Mode A: extract the last segment with extension stripped (n = -1 linkage)
get_path_info(paths, n = -1, rm_extension = TRUE)

# Mode A: range extraction
get_path_info(paths, n = c(2, 3))

Example files: mintyr_example()

# Get path to an example file
mintyr_example("csv_test1.csv")

List example files: mintyr_examples()

# List all example files
mintyr_examples()


Try the mintyr package in your browser

Any scripts or data that you put into this service are public.

mintyr documentation built on Oct. 5, 2026, 5:08 p.m.