hipread (version 0.1.1)

hipread_freqs: Calculate frequencies from fixed width file without loading into memory

Description

Calculate the frequency of values in all variables in a fixed width file. Does so without holding the whole data in memory or creating a full R data.frame and calling R code on interim pieces. (Probably only useful inside IPUMS HQ).

Usage

hipread_freqs(file, var_info, rt_info = hip_rt(1, 0), compression = NULL,
  progress = show_progress())

Arguments

file

A filename

var_info

Variable information, specified by either hip_fwf_positions() or hip_fwf_widths(). For hierarchical data files, there should be a named list, where the name is the value indicated by the record type variable and there is one variable information per record type.

rt_info

A record type information object, created by hip_rt(), which contains information about the location of the record type variable that defines the record type for each observation. The default contains width 0, which indicates that there the data is rectangular and does not have a record type variable.

compression

If NULL, guesses the compression from the file extension (if extension is "gz" uses gzip, otherwise treats as plain text), can specify it with a string ("txt" indicates plain text and "gz" for gzip).

progress

A logical indicating whether progress should be displayed on the screen, defaults to showing progress unless the current context is non-interactive or in a knitr document or if the user has turned off readr's progress by default using the option options("readr.show_progress").

Value

A list of frequencies