ipumsr (version 0.4.5)

ipums_callback: Callback classes

Description

These classes are used to define callback behaviors that have been adapted for use on IPUMS microdata extracts. Though the callbacks from the readr package will work, they will not handle implicit decimals or add value/variable labels to the data.

Arguments

Super classes

hipread::ChunkCallback -> hipread::HipChunkCallback -> IpumsChunkCallback

Methods

Public methods

Method set_ipums_fields()

Usage

IpumsChunkCallback$set_ipums_fields(
  data_structure,
  ddi,
  var_attrs,
  rt_ddi = NULL
)

Method clone()

The objects of this class are cloneable with this method.

Usage

IpumsChunkCallback$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Methods

Public methods

Method new()

Usage

IpumsSideEffectCallback$new(callback)

Method receive()

Usage

IpumsSideEffectCallback$receive(data, index)

Method continue()

Usage

IpumsSideEffectCallback$continue()

Method clone()

The objects of this class are cloneable with this method.

Usage

IpumsSideEffectCallback$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Methods

Public methods

Method new()

Usage

IpumsDataFrameCallback$new(callback)

Method receive()

Usage

IpumsDataFrameCallback$receive(data, index)

Method result()

Usage

IpumsDataFrameCallback$result()

Method finally()

Usage

IpumsDataFrameCallback$finally()

Method clone()

The objects of this class are cloneable with this method.

Usage

IpumsDataFrameCallback$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Methods

Public methods

Method new()

Usage

IpumsListCallback$new(callback)

Method receive()

Usage

IpumsListCallback$receive(data, index)

Method result()

Usage

IpumsListCallback$result()

Method finally()

Usage

IpumsListCallback$finally()

Method clone()

The objects of this class are cloneable with this method.

Usage

IpumsListCallback$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Methods

Public methods

Method new()

Usage

IpumsBiglmCallback$new(model, prep = function(x, pos) x, ...)

Method receive()

Usage

IpumsBiglmCallback$receive(data, index)

Method result()

Usage

IpumsBiglmCallback$result()

Method clone()

The objects of this class are cloneable with this method.

Usage

IpumsBiglmCallback$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Details

IpumsSideEffectCallback

Callback function that is used only for side effects, no results are returned. Initialize with a function that takes 2 arguments x (which will be the data chunk) and an integer that indicates the position of the first observation in the chunk. If the function returns FALSE, no more chunks will be read.

IpumsDataFrameCallback

Callback function that combines each result together into a data.frame at the end. Initialize the same was as IpumsSideEffectCallback, and the results from the function will be fed into a data.frame.

IpumsListCallback

Callback function that returns a list, where each item is the result from a chunk. Initalize the same was as IpumsSideEffectCallback.

IpumsBiglmCallback

Callback function that performs a regression on the full dataset, one chunk at a time using the biglm package. Initialize with arguments model (A formula of your model and prep a function like the other callback arguments that prepares the data before running the regression. Other arguments are passed to biglm.

IpumsChunkCallback

(Only needed for advanced usage) Callback interface definition, all callback functions for IPUMS data should inherit from this class, and should use private method ipumsify on the data to handle implicit decimals and value labels.