Skip to contents

Read fusion output that was written directly to disk via fuse.

Usage

read_fsd(fsd, columns = NULL, cores = data.table::getDTthreads())

Arguments

fsd

Character. File path ending in .fsd as produced by call to fuse.

columns

Character. Column names to read. The default is to read all columns.

cores

Integer. Number of cores used by fread.

Value

A data.table with integer column "M" indicating the implicate assignment of each observation. Note that the ordering of recipient observations is consistent within implicates, so do not change the row order if using with analyze or validate.

Details

As of version 3.0, this is simply a convenient wrapper around read_fst, since fusion output data files (.fsd) produced by fuse are actually native fst files under the hood.

Examples

# Build a fusion model using RECS microdata
# Note that "fusion_model.fsn" will be written to working directory
?recs
fusion.vars <- c("electricity", "natural_gas", "aircon")
predictor.vars <- names(recs)[2:12]
fsn.path <- train(data = recs, y = fusion.vars, x = predictor.vars)

# Write fusion output directly to disk
# Note that "results.fsd" will be written to working directory
recipient <- recs[predictor.vars]
sim <- fuse(data = recipient, fsn = fsn.path, M = 5, csv = "results.fsd")

# Read the fusion output saved to disk
sim <- read_fsd(sim)
head(sim)