Learn R Programming

dodgr (version 0.4.2)

dodgr_save_streetnet: Save a weighted streetnet to a local file

Description

The weight_streetnet function returns a single data.frame object, the processing of which also relies on a couple of cached lookup-tables to match edges in the data.frame to objects in the original input data. It automatically calculates and caches a contracted version of the same graph, to enable rapid conversion between contracted and uncontracted forms. This function saves all of these items in a single .Rds file, so that a the result of a weight_streetnet call can be rapidly loaded into a workspace in subsequent sessions, rather than re-calculating the entire weighted network.

Usage

dodgr_save_streetnet(net, filename = NULL)

Arguments

net

data.frame or equivalent object representing the weighted network graph.

filename

Name with optional full path of file in which to save the input net. The extension .Rds will be automatically appended, unless specified otherwise.

See Also

Other cache: clear_dodgr_cache(), dodgr_cache_off(), dodgr_cache_on(), dodgr_load_streetnet()

Examples

Run this code
net <- weight_streetnet (hampi)
f <- file.path (tempdir (), "streetnet.Rds")
dodgr_save_streetnet (net, f)
clear_dodgr_cache () # rm cached objects from tempdir
# at some later time, or in a new R session:
net <- dodgr_load_streetnet (f)

Run the code above in your browser using DataLab