Utilities for paths, files and directories.
R package of utilities for handling paths, files and directories
To install, you first need the devtools package.
install.packages("devtools")
Then you can install the pathological package using
library(devtools)install_github("richierocks/pathological")
decompose_path
splits a path into a directory name, file name (without
extension), and a file extension. recompose_path
reverses the effects of
this function.
get_extension
, strip_extension
, and replace_extension
allow manipulation
of file extensions. They are smart enough to deal with double extensions like
tar.gz
.
On Windows, get_drive
returns the drive name of the path.
copy_dir
copies the contents of a directory.
standardize_path
(and standardise_path
, for British English fans) is a
wrapper to base::normalizePath
that standardizes the form of a path, to make
them more easily comparable. You can choose whether you want back or forward
slashes, and the inputs paths are given as names.
r_home
, temp_dir
, temp_file
, system_file
, and sys_which
provide
standardized versions of the similarly named base R functions.
os_path
returns the operating system PATH
environment variable as a
character vector of stanardized paths.
On Windows, cygwinify_path
makes paths suitable for use with cygwin.
0.1-2 standardize_path more consistent for missing and ".." paths. 0.1-1 Some problematic tests marked as skip_on_cran(). 0.1-0 Added split_dir (dir + split_path). Added a vignette. parent_dir gets a default argument. Attempt to fix the problems with CRAN Windows build. 0.0-9 Bug fix release: standardize_path rewritten to fix some cross-platform issues. In particular it enforces backslashes at the start of UNC paths. 0.0-8 Added create_files fns. create_dirs now only tries to create directories that don't already exist. temp_dir, temp_file now vectorized & accept paths within temp dir via ... arg. (Minor breaking change.) 0.0-7 Added r_environ(_site), choose_files, choose_dir fns. Works with new assertive.* pkgs. Some fns no longer return named output. 0.0-6 Fixes for stringr 1.0.0. 0.0-5 Added is_windows_drive, r_profile, get_libraries. 0.0-3 More testing, quality fixes. 0.0-2 First releasable version. Added wrappers to base-R's file and dir functions for consistent syntax and output. Also added more utility functions and tests. 0.0-1 Added decompose_path and dir_copy.