Skip to contents

Loads a sheet from one of the Crime Statistics Agency workbooks, downloading and caching the file on first use.

Usage

morie_datasets_vic_table(key, table = 1, cache_dir = NULL, offline = TRUE)

Arguments

key

A catalog key; see morie_datasets_vic_catalog().

table

Sheet to read: an integer table number (1 gives "Table 01") or a sheet name.

cache_dir

Optional cache directory.

offline

When TRUE (the default) the function never downloads: it reads a cached copy and otherwise returns a 0-row frame, so examples and tests never touch the network.

Value

A data.frame of the requested table, or a 0-row frame when the workbook is not cached and offline is TRUE.

References

Crime Statistics Agency (Victoria), CC BY 4.0.

Examples

# offline by default: the sample bundled in rmoriedata, or the live
# workbook once it has been cached with offline = FALSE
df <- morie_datasets_vic_table("criminal_incidents", table = 1)
ncol(df)
#> [1] 7