Skip to contents

Utility to load a couple of datasets using data immediately instead of relying on lazy loading

Usage

dataload_from_package(
  olist = c("blockgroupstats", "usastats", "statestats"),
  envir = globalenv()
)

Arguments

olist

vector of strings giving names of objects to load using data(). This could also include other large datasets that are slow to lazyload but not always needed: "frs", "frs_by_programid ", "frs_by_naics", etc.

envir

the environment into which they should be loaded

Value

Nothing

Details

See also read_builtin() function from the readr package!

Default is to load some but not all the datasets into memory immediately. blockgroupstats, usastats, statestats, and some others are always essential to EJAM, but frs and frs_by_programid are huge datasets (and frs_by_sic and frs_by_naics) and not always used - only to find regulated facilities by ID, etc. The frs-related datasets here can be roughly 1.5 GB in RAM, perhaps.

Examples

  x <- datapack("EJAM")
  subset(x, x$size >= 0.1) # at least 100 KB
  grep("names_", x$Item, value = T, ignore.case = T, invert = T) # most were like names_d, etc.
  ls()
  data("avg.in.us", package="EJAM") # lazy load an object into memory and make it visible to user
  ls()
  rm(avg.in.us, x)