add_microdata_location: Add a specified location for microdata not in the Grattan...

View source: R/add_microdata_location.R

add_microdata_locationR Documentation

Add a specified location for microdata not in the Grattan data warehouse

Description

Some microdata, such as HILDA, has access restrictions that mean it cannot be stored on Dropbox, even with the security controls we have in place. This function allows you to store microdata somewhere else, but still load it with the 'read_microdata()' function. This increases reproducibility within Grattan. 'read_microdata()' will look both in the data warehouse and in the location you add with 'add_microdata_location()'.

Usage

add_microdata_location(path)

Arguments

path

File path to non-data warehouse microdata location, such as 'file.path("~", "my_data", "hilda")

Value

Sets an environment variable '"R_GRATTANDATA_LOCATION"'. When this variable is set, 'grattandata' functions including 'read_microdata()' will look for the data file(s) you request in the specified location as well as in the Grattan data warehouse.

Note

You can only set one location (in addition to the Grattan data warehouse). All subfolders of the defined location will be included in the search path for 'read_microdata()'.

We recommend that you use the 'add_microdata_location()' function in your scripts rather than defining the '"R_GRATTANDATA_LOCATION"' environment variable elsewhere, to improve clarity/reproducibility of your code.

Examples

## Not run: 
add_microdata_location(path = file.path("documents", "hilda"))

read_microdata("hilda_file.dta")

## End(Not run)

grattan/grattandata documentation built on May 10, 2022, 9:33 p.m.