get_date: Create a date from NOAA data given DAY, MONTH, YEAR

Description Usage Arguments Value Examples

View source: R/obtain and clean data.R

Description

The NOAA data has columns called DAY, MONTH, YEAR. Part of the requirements for cleaning this data is to create a date column. All of the years are provided, but some of the months and days are NA. We'll replace NA days with 1st and NA months with Jan. Also, note that as.Date does not play nice with negative years, so these have been removed. Vectors days, months and years must be of the same length.

Usage

1
get_date(days, months, years)

Arguments

days

Day of the year as integer vector

months

Month of the year as integer vector

years

An integer vector of years

Value

A vector of the date objects returned from passing date strings to as.Date

Examples

1
2
3
4
5
6
7
## Not run: 
  df <- load_data() %>% dplyr::filter(YEAR >= 0) %>%
       dplyr::mutate(date = get_date(DAY, MONTH, YEAR))
  print(class(df))
  head(df)

## End(Not run)

dannyjwpark/NOAA documentation built on Dec. 31, 2020, 11:11 p.m.