define_dates2load: Create a dataframe that specifies which FVCOM files to load

View source: R/define_dates2load.R

define_dates2loadR Documentation

Create a dataframe that specifies which FVCOM files to load

Description

This function creates a dataframe that can be used to load FVCOM files into R or MATLAB.

Usage

define_dates2load(
  start_date,
  end_date,
  custom_dates = NULL,
  corrupt_dates = NULL
)

Arguments

start_date

A date object specifying the earliest date for which you have a FVCOM file.

end_date

A date object specifying the latest date for which you have a FVCOM file. Specifying start_date and end_date is appropriate if you want to load all dates between a start and end date. If not, see custom_dates.

custom_dates

A vector of dates, for which to create the dataframe. This is an alternative to specifying start_date and end_date (see above).

corrupt_dates

A vector of dates for which FVCOM files are corrupt and should not be included in the dataframe.

Value

A dataframe with three columns: date (a Date object), year (2 digits, a numeric object) and date_name (6 digits, a numeric object).

Author(s)

Edward Lavender

Examples


# 1) Define a dataframe for a regular sequence of dates between a start and end date:
define_dates2load(start_date = as.Date("2016-03-01"),
                  end_date = as.Date("2016-03-05"),
                  corrupt_dates = NULL)

# 2) Define a dataframe as above, but removing some corrupt dates:
define_dates2load(start_date = as.Date("2016-03-01"),
                  end_date = as.Date("2016-03-05"),
                  corrupt_dates = as.Date(c("2016-03-02", "2016-03-03"))
                  )

# 3) Define a dataframe for a custom series of dates:
define_dates2load(custom_dates = as.Date(c("2016-03-02", "2016-03-03", "2017-01-01")))


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