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")
#> Error in datapack("EJAM"): could not find function "datapack"
  subset(x, x$size >= 0.1) # at least 100 KB
#> Error: object 'x' not found
  grep("names_", x$Item, value = T, ignore.case = T, invert = T) # most were like names_d, etc.
#> Error: object 'x' not found
  ls()
#> character(0)
  data("avg.in.us", package="EJAM") # lazy load an object into memory and make it visible to user
  ls()
#> character(0)
  rm(avg.in.us, x)
#> Warning: object 'avg.in.us' not found
#> Warning: object 'x' not found