MazamaScience/RAWSmet

rename "List" functions and refactor to use purrr

Closed this issue · 0 comments

Background:

Mazama Science uses an <object>_<verb>() naming scheme for many package functions. Thus the raws_filter() function accepts a raws object as its first argument and then performs the filter() action on it, returning a modified raws object. Thus, many of the raws_~() functions can be chained together in recipe fashion like this:

data <-
  fw13_load(...) %>%
  raws_filterDate(...) %>%
  raws_filter(windSpeed > 5) %>%
  raws_extractData() %>%

A rawsList is a new kind of object that we are starting to create functions for and will need a rawsList_ prefix.

Task:

  • rename raws_filterList() to rawsList_filter() with a first argument named rawsList
  • rename raws_filterDateList() to rawsList_filterDate() with a first argument named rawsList
  • refactor the guts of these functions to use one of the purrr::map() functions to apply a function to each member of a rawsList. The base::lapply()` function would also work but I think we should start working with purrr if we are going to support lists of objects.