README.md

pathr

Proof of concept for a tidyverse style package for dealing with files.

First step, dealing with filenames.

library(pathr)
files <- list.files(full.names = TRUE, recursive = TRUE)

path_dir_name(files)
#> [1] "."   "."   "."   "."   "./R" "."   "."
path_file_name(files)
#> [1] "DESCRIPTION"     "LICENSE"         "NAMESPACE"       "pathr.Rproj"    
#> [5] "pathr-package.r" "README.md"       "README.Rmd"
path_base_name(files)
#> [1] "./DESCRIPTION"     "./LICENSE"         "./NAMESPACE"      
#> [4] "./pathr"           "./R/pathr-package" "./README"         
#> [7] "./README"
path_file_ext(files)
#> [1] ""      ""      ""      "Rproj" "r"     "md"    "Rmd"

path_normalize(files)
#> [1] "C:\\Users\\trist\\OneDrive\\Documents\\laptop\\GitRepos\\pathr\\DESCRIPTION"       
#> [2] "C:\\Users\\trist\\OneDrive\\Documents\\laptop\\GitRepos\\pathr\\LICENSE"           
#> [3] "C:\\Users\\trist\\OneDrive\\Documents\\laptop\\GitRepos\\pathr\\NAMESPACE"         
#> [4] "C:\\Users\\trist\\OneDrive\\Documents\\laptop\\GitRepos\\pathr\\pathr.Rproj"       
#> [5] "C:\\Users\\trist\\OneDrive\\Documents\\laptop\\GitRepos\\pathr\\R\\pathr-package.r"
#> [6] "C:\\Users\\trist\\OneDrive\\Documents\\laptop\\GitRepos\\pathr\\README.md"         
#> [7] "C:\\Users\\trist\\OneDrive\\Documents\\laptop\\GitRepos\\pathr\\README.Rmd"

path_create(".", "R", "pathr-package.r")
#> [1] "./R/pathr-package.r"


tjmahr/pathr documentation built on May 27, 2017, 9:42 a.m.