| get_ext | R Documentation |
Extract file extension(s) from a file name or path. Supports vector input and optionally preserves compound extensions (e.g., .tar.gz) when keep_all = TRUE.
get_ext(paths, keep_all = FALSE, include_dot = FALSE, to_lower = FALSE)
paths |
Character vector of file names or paths. |
keep_all |
Logical. If TRUE, returns full suffix after first dot in basename. If FALSE, returns only the last extension. Default is FALSE. |
include_dot |
Logical. If TRUE, includes the leading dot in result. Default is FALSE. |
to_lower |
Logical. If TRUE, converts extensions to lowercase. Default is FALSE. |
Character vector of extensions.
get_ext("data.csv") # "csv"
get_ext("archive.tar.gz") # "gz"
get_ext("archive.tar.gz", TRUE) # "tar.gz"
get_ext(c("a.R", "b.txt", "c")) # "R" "txt" ""
get_ext("data.CSV", to_lower = TRUE) # "csv"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.