parseFilenames: parse sensorgnome filenames into components

View source: R/parseFilenames.R

parseFilenamesR Documentation

parse sensorgnome filenames into components

Description

parse sensorgnome filenames into components

Usage

parseFilenames(f, base = basename(f), checkDOS = TRUE)

Arguments

f

character vector of filenames with full path

base

character vector of file basenames; these default to basename(f), but will differ when the basename has been corrected (e.g. to remove invalid UTF-8 sequences).

checkDOS

if TRUE, the default, try to correct DOS 8.3-style filenames; if FALSE, return NA for rows corresponding to these.

Value

a dataframe of components, with one row per filename and these columns:

  1. prefix: human readable short site name

  2. serno: receiver serial number; "SG-" followed by 12 alphanumeric characters e.g. 1315BBBK2156, or possibly with an appended "_N" where N is 1, 2, ... for disentangling serial number collisions. Alphabetic characters are converted to upper case.

  3. bootnum: boot count (integer)

  4. tsString: timestamp in YYYY-MM-DDTHH-MM-SS.SSSS format

  5. ts: timestamp embedded in name (double, with class c("POSIXt", "POSIXct") )

  6. tsCode: timestamp code ('P' means before GPS fix, 'Z' means accurate to 1e-6 s, 'Y' to 1e-5s, 'X' to 1e-4s, ..., 'T' to 1s)

  7. port: character; port label, if this file is associated with a single port (e.g. a .WAV file); "all" if all ports

  8. extension: character extension of uncompressed file; e.g. ".txt"; lower case

  9. comp: character; file compression type, if any: "", or ".gz"; lower case

Note

:

  • returns NULL if no filenames match regex; otherwise, return value has rows filled with NA for any filenames not matching the expected form

  • serial number collisions are resolved based on prefix and possibly other filename components - see the variable sernoCollisionFixes. Resolution occurs by adding a suffix to the serno field returned by this function, but does not rename files.


MotusWTS/motusServer documentation built on Aug. 8, 2024, 10:23 p.m.