Skip to content
/ fml Public

๐Ÿ“ File Management and Location Tools ๐Ÿ“‚

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

mkearney/fml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

26 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

fml

Build status CRAN status Coverage Status

Downloads Downloads lifecycle

File Management and Location tools

Installation

Install the development version from Github with:

## install remotes pkg if not already
if (!requireNamespace("remotes", quietly = TRUE)) {
  install.packages("remotes")
}

## install from github
remotes::install_github("mkearney/fml")

Find or search for files

  • find_file(): find a file (exact matches)
## find the rtweet readme
find_file("rtweet", "README.Rmd")
#> [1] "/Users/mwk/R/rtweet/README.Rmd"
  • search_file(): search for files using wildcard expansion
    • *: match zero or more characters
    • ?: match a single character
    • [: begin a character class or range
## starts with capital letter and doesn't end with md/html
search_file("[A-Z]*[!md|html]")
#> [1] "/Users/mwk/R/fml/DESCRIPTION" "/Users/mwk/R/fml/LICENSE"    
#> [3] "/Users/mwk/R/fml/NAMESPACE"   "/Users/mwk/R/fml/docs/CNAME"

## all .yml files not in docs/
search_file("[!docs]*.yml")
#> [1] "/Users/mwk/R/fml/_pkgdown.yml"     "/Users/mwk/R/fml/docs/pkgdown.yml"

## .yml files that start with a dot
search_file(".*.yml")
#> [1] "/Users/mwk/R/fml/.travis.yml"

Files in projects

  • here(): smart file paths within project
## locate file in project
here("R", "fp.R")
#> [1] "/Users/mwk/R/fml/R/fp.R"

List files/directories

  • list_files(): list files
## list files in directory
list_files(full = FALSE)
#> [1] "_pkgdown.yml" "codecov.yml"  "DESCRIPTION"  "fml.Rproj"   
#> [5] "LICENSE"      "LICENSE.md"   "NAMESPACE"    "README.md"   
#> [9] "README.Rmd"
  • list_dirs(): list directories
## list dirs in directory
list_dirs(full = FALSE)
#> [1] "docs"    "man"     "pkgdown" "R"       "tests"
  • list_paths(): list all paths
## list files AND paths in directory
list_paths(full = FALSE)
#>  [1] "_pkgdown.yml" "codecov.yml"  "DESCRIPTION"  "docs"        
#>  [5] "fml.Rproj"    "LICENSE"      "LICENSE.md"   "man"         
#>  [9] "NAMESPACE"    "pkgdown"      "R"            "README.md"   
#> [13] "README.Rmd"   "tests"

Misc

  • fp(): construct file path
## build this/that
fp("this", "that")
#> [1] "this/that"

## pipe style
"this" %FP% "that"
#> [1] "this/that"
  • pe(): path expansionโ€“converts to canonical form
## build this/that
pe(fp(".", "this", "that"))
#> [1] "./this/that"

## pipe style
pe("~" %FP% "this" %FP% "that")
#> [1] "/Users/mwk/this/that"

About

๐Ÿ“ File Management and Location Tools ๐Ÿ“‚

Topics

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published