exclude_unavailable: Exclude any rows in a dataframe associated with unavailable...

View source: R/excludes.R

exclude_unavailableR Documentation

Exclude any rows in a dataframe associated with unavailable FVCOM files

Description

This function screens vector of FVCOM file names in a dataframe and removes any rows which refer to FVCOM files that are unavailable in a specified directory. This is an important check prior to loading multiple FVCOM files into R.

Usage

exclude_unavailable(dat, dir2load, ...)

Arguments

dat

A dataframe (e.g. containing information necessary to extract FVCOM outputs). The only requirement is an integer column named 'date_name' which contains the 6 digit code of FVCOM file names (see date_name).

dir2load

A string which defines the directory from which FVCOM files are loaded. The function identifies all files in this directory (with necessary properties, see ...) to determine whether any of the date names in dat are not found dir2load. If this is the case, these rows which refer to unavailable files in dat are removed.

...

Additional arguments passed to list.files, such as pattern.

Value

A dataframe, as inputted, but in which any rows which refer to the names of unavailable FVCOM files have been excluded. If rows have been excluded, the function returns a warning.

Author(s)

Edward Lavender

See Also

This check is implemented by extract.

Examples


## Not run: 
path <- system.file("WeStCOMS_files/tidal_elevation",
                    package = "fvcom.tbx", mustWork = TRUE)
exclude_unavailable(data.frame(date_name = c(160301, 160302, 160303)), path)
exclude_unavailable(data.frame(date_name = c(160301, 160302, 160303), depth = c(60,  65, 90)), path)

## End(Not run)


edwardlavender/fvcom.tbx documentation built on Nov. 26, 2022, 10:28 p.m.