scoop: Fetch a dataset from the puddle, or if its not present, fetch...

Description Usage Arguments

View source: R/scoop.R

Description

Fetch a dataset from the puddle, or if its not present, fetch the dataset from elsewhere, store it in the puddle, and then pass it along to you.

Usage

1
2
3
4
5
6
7
8
scoop(
  FETCH_FUN,
  READ_FUN,
  data_name,
  description,
  renew = FALSE,
  puddle = ":memory:"
)

Arguments

FETCH_FUN

A zero-argument function that fetches raw data, such as a csv file, xml, or json, and returns it.

READ_FUN

A one-argument function that takes the raw data of FETCH_FUN and returns a dataframe. For example, read.csv, or function(text) read.csv(text, stringsAsFactors=F)

data_name

A name for the dataset in the puddle. Must be unique in the puddle.

description

Descriptive text about the dataset.

renew

Should scoop run FETCH_FUN, even if the data is already in the the puddle, and store the new version?

puddle

A string for connecting to the sqlite puddle database. Defaults to ':memory:', which is only really useful for demonstration.

FETCH_FUN and READ_FUN are complementary. They can be whatever you want, so long as the composition, READ_FUN( FETCH_FUN() ) returns your dataset as a dataframe.


CLSPhila/puddle documentation built on Dec. 17, 2021, 12:57 p.m.