-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
116 lines (81 loc) 路 2.54 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, include = FALSE}
knitr::opts_chunk$set(echo = TRUE, collapse = TRUE, comment = "#>")
library(fml)
```
# fml <img src="man/figures/logo.png" width="160px" align="right" />
[![Build status](https://travis-ci.org/mkearney/fml.svg?branch=master)](https://travis-ci.org/mkearney/fml)
[![CRAN status](https://www.r-pkg.org/badges/version/fml)](https://cran.r-project.org/package=fml)
[![Coverage Status](https://codecov.io/gh/mkearney/fml/branch/master/graph/badge.svg)](https://codecov.io/gh/mkearney/fml?branch=master)
![Downloads](https://cranlogs.r-pkg.org/badges/fml)
![Downloads](https://cranlogs.r-pkg.org/badges/grand-total/fml)
[![lifecycle](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
**F**ile **M**anagement and **L**ocation tools
## Installation
Install the development version from Github with:
``` r
## 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)
```{r}
## find the rtweet readme
find_file("rtweet", "README.Rmd")
```
+ **`search_file()`**: search for files using [wildcard expansion](http://pubs.opengroup.org/onlinepubs/9699919799/functions/glob.html)
- **`*`**: match zero or more characters
- **`?`**: match a single character
- **`[`**: begin a character class or range
```{r}
## starts with capital letter and doesn't end with md/html
search_file("[A-Z]*[!md|html]")
## all .yml files not in docs/
search_file("[!docs]*.yml")
## .yml files that start with a dot
search_file(".*.yml")
```
## Files in projects
+ **`here()`**: smart file paths within project
```{r}
## locate file in project
here("R", "fp.R")
```
## List files/directories
+ **`list_files()`**: list **files**
```{r}
## list files in directory
list_files(full = FALSE)
```
+ **`list_dirs()`**: list **directories**
```{r}
## list dirs in directory
list_dirs(full = FALSE)
```
+ **`list_paths()`**: list all **paths**
```{r}
## list files AND paths in directory
list_paths(full = FALSE)
```
## Misc
+ **`fp()`**: construct file path
```{r}
## build this/that
fp("this", "that")
## pipe style
"this" %FP% "that"
```
+ **`pe()`**: path expansion鈥揷onverts to canonical form
```{r}
## build this/that
pe(fp(".", "this", "that"))
## pipe style
pe("~" %FP% "this" %FP% "that")
```