sort_filepaths: Sorts a data.frame or tibble of filepaths

Description Usage Arguments Value Examples

View source: R/sort_filepaths.R

Description

Sorts a data.frame or tibble of filepaths. In the filepaths, it is assumed you have an ID that is at least 3 digits long. The function will sort each column in the input, check each row of IDs matches, and add a new column of the ID.

Usage

1
sort_filepaths(filepaths, id_pattern = "[0-9][0-9][0-9]+")

Arguments

filepaths

A data.frame or tibble of filepaths with an ID contained

id_pattern

By default is a 3 digit pattern. Searches for the pattern indicated as a subject ID.

Value

A sorted tibble of filepaths with an ID column

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
files = tibble::tibble(files1 = c('/Desktop/subject_111.csv',
                                  '/Desktop/subject_123.csv',
                                  '/Desktop/subject_902'),
                       files2 = c('/Documents/subject_111.csv',
                                  '/Documents/subject_902',
                                  '/Documents/subject_123.csv'))

sort_filepaths(filepaths = files)

## End(Not run)

avalcarcel9/aliviateR documentation built on July 10, 2020, 12:32 p.m.