FilenameMapper-class: Make sure to call $readMappingFile(some_file) if you want to...

FilenameMapper-classR Documentation

Make sure to call $readMappingFile(some_file) if you want to support a user-defined file mapping. Otherwise, calls to $getShortNames() will create/augment the mapping for filenames.

Description

Make sure to call $readMappingFile(some_file) if you want to support a user-defined file mapping. Otherwise, calls to $getShortNames() will create/augment the mapping for filenames.

Fields

raw_file_mapping

Data.frame with columns 'from', 'to' and maybe 'best.effort' (if shorting was unsuccessful)

mapping.creation

how the current mapping was obtained (user or auto)

external.mapping.file

Filename of user-defined mapping file; only defined if readMappingFile() was called

Methods

getShortNamesStatic(raw.files, max_len, fallbackStartNr = 1)

Static method: Shorten a set of Raw file names and return a data frame with the mappings. Mapping will have: $from, $to and optionally $best.effort (if shorting was unsuccessful and numbers had to be used)

  • ⁠raw.files⁠ Vector of Raw files.

  • ⁠max_len⁠ Maximal length of shortening results, before resorting to canonical names (file 1,...).

  • ⁠fallbackStartNr⁠ Starting index for canonical names.

Return Value

data.frame with mapping.

Examples

a = FilenameMapper$new()
a$readMappingFile('filenamemapping.txt') 


cbielow/PTXQC documentation built on March 13, 2024, 5:08 a.m.