An open API service indexing awesome lists of open source software.

https://github.com/krlmlr/pkgfiles

Statistics and Tools for Files in Your R Project
https://github.com/krlmlr/pkgfiles

file-classifier r

Last synced: 4 months ago
JSON representation

Statistics and Tools for Files in Your R Project

Awesome Lists containing this project

README

        

---
output:
github_document:
html_preview: false
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# pkgfiles

[![Travis build status](https://travis-ci.org/krlmlr/pkgfiles.svg?branch=master)](https://travis-ci.org/krlmlr/pkgfiles)
[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/krlmlr/pkgfiles?branch=master&svg=true)](https://ci.appveyor.com/project/krlmlr/pkgfiles)
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
[![CRAN status](https://www.r-pkg.org/badges/version/pkgfiles)](https://cran.r-project.org/package=pkgfiles)

The goal of pkgfiles is to enumerate and classify all files in an R package project. This is mostly useful for other packages that iterate over all files of a specific kind in an R package.

## Installation

Once released, you can install the released version of pkgfiles from [CRAN](https://CRAN.R-project.org) with:

``` r
install.packages("pkgfiles")
```

For now, install from GitHub with

``` r
# install.packages("devtools")
devtools::install_github("krlmlr/pkgfiles")
```

## Example

The `pf_get()` function enumerates and classifies all files in the current project.

```{r example}
library(pkgfiles)
pf_get()
```

Under the hood, the returned object is a tibble that contains the return from a `fs::dir_info()` call augmented by a `class` column:

```{r}
tibble::as_tibble(pf_get())
```

The classification is based on regular expressions for the project-relative path of the files. This list is extensible but the existing entries should rarely change.

```{r}
pkgfiles:::classification
```