Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/elipousson/filenamr
🗄️ A R package for working with filenames
https://github.com/elipousson/filenamr
file-naming r-package
Last synced: 10 days ago
JSON representation
🗄️ A R package for working with filenames
- Host: GitHub
- URL: https://github.com/elipousson/filenamr
- Owner: elipousson
- License: other
- Created: 2022-11-25T05:17:24.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-17T23:12:02.000Z (about 2 months ago)
- Last Synced: 2024-10-12T12:18:52.839Z (26 days ago)
- Topics: file-naming, r-package
- Language: R
- Homepage: https://elipousson.github.io/filenamr/
- Size: 1.5 MB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
- License: LICENSE
- Codemeta: codemeta.json
Awesome Lists containing this project
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```# filenamr
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![Codecov test coverage](https://codecov.io/gh/elipousson/filenamr/branch/main/graph/badge.svg)](https://app.codecov.io/gh/elipousson/filenamr?branch=main)The goal of filenamr is to help in creating and modifying file names and paths. It also supports reading and writing EXIF metadata. It is primarily useful for the development of packages that work with file reading and writing and need some utilities to support this goal.
## Installation
You can install the development version of filenamr like so:
``` r
pak::pkg_install("elipousson/filenamr")
```## Making file names
The `make_filename()` function is design for creating structured file names based on a name and optional label, prefix, or postfix:
```{r example}
library(filenamr)make_filename(
name = "Neighborhoods",
label = "Baltimore, MD"
)make_filename(
prefix = "Plot",
name = "Neighborhoods",
label = "Baltimore, MD"
)make_filename(
prefix = "date",
name = "Neighborhoods",
label = "Baltimore, MD",
postfix = "map",
fileext = "jpeg"
)
```You can also pass a filename with an extension or path (setting `create = TRUE` to create a directory if no directory already exist):
```{r}
make_filename(
filename = "baltimore_neighborhoods",
path = "data",
fileext = "pdf",
create = FALSE
)
```If you provide a number as part of a filename, you can use the increment parameter to create a filename where the number is replaced with a larger number:
```{r}
make_filename(
filename = "plot",
postfix = "1",
increment = TRUE,
fileext = "png"
)make_filename(
filename = "plot",
postfix = "1",
increment = 2,
fileext = "png"
)
```## Working with file metdata
This package uses the exiftoolr package (installing the development version on GitHub is recommended) to support reading and writing EXIF, IPTC, and XMP-DC metadata.