utils: File path utilities for TargetSearch

utilsR Documentation

File path utilities for TargetSearch

Description

A collection of simple functions to quickly access the TargetSearchData data files. These functions are used throughout TargetSearch examples. See details for an explanation of each function.

Usage

  tsd_path()

  tsd_data_path(datapath='gc-ms-data')

  tsd_file_path(filename, ...)

  tsd_cdffiles(...)

  tsd_rifiles(...)

Arguments

datapath

A character string. This is the name of the subdirectory in which the example files for TargetSearch are installed. This value is hard-coded as 'gc-ms-data' (because this is were the files are), so there is little need to change it.

filename

A character vector or a string. This is the name(s) of the file(s) whose absolute path is to be returned. The function checks internally that the file(s) exist.

...

parameters passed to ts_data_path, more precisely datapath.

Details

tsd_path() returns the path of TargetSearchData. It is a shorthand for find.package('TargetSearchData').

tsd_data_path() returns the full path of the directory where the CDFs and other example files of TargetSearch are located. This path is hard-coded to 'gc-ms-data'. The path can be changed by setting the data path parameter datapath, though this is unnecessary in general.

tsd_file_path() returns the absolute path of one or more files (filename) inside the data directory (datapath). The function checks whether the file exist and fails if not. The name of the first missing file is printed.

tsd_cdffiles() and tsd_rifiles() are convenience functions that return the list of NetCDF files and RI files contained in the data path, respectively.

Value

All functions return a character vector. They are paths to files or directories within TargetSearchData. The functions tsd_cdffiles and tsd_rifiles return a list of files.

Author(s)

Alvaro Cuadros-Inostroza

See Also

The package TargetSearch

Examples

  # get TargetSearchData path
  path <- tsd_path()

  # get TargetSearchData data path
  path <- tsd_data_path()

  # get the path to the files "samples.txt" in TargetSearchData
  path <- tsd_file_path('samples.txt')

  # get the list of CDF files
  cdffiles <- tsd_cdffiles()

  # get the list of RI files
  rifiles <- tsd_rifiles()

acinostroza/TargetSearchData documentation built on Nov. 1, 2024, 12:49 a.m.