Skip to contents

A thin wrapper around dl_write() for writing analysis result objects to the standardized datalake structure under "results/{result_type}".

Usage

dl_write_result(
  x,
  result_type = c("conjoint", "maxdiff", "segmentation", "brand", "list_experiment",
    "appraise", "model", "other"),
  name = NULL,
  version = NULL,
  wave = NULL,
  overwrite = TRUE,
  verify = TRUE,
  verbose = TRUE,
  project = dl_get_project(),
  env = "prod"
)

Arguments

x

Object to upload (tibble, model, or list).

result_type

Character scalar defining the result category. Must be one of "conjoint", "maxdiff", "segmentation", "brand", "list_experiment", "appraise", "model", or "other".

name

Optional character scalar defining the result name. Can be NULL.

version

Optional character scalar defining the result version. Can be NULL.

wave

Optional character scalar defining the survey wave.

overwrite

Logical. If FALSE, prompts before overwriting existing file. Default is TRUE.

verify

Logical. If TRUE, reads object back after upload and checks if identical to the input. Default is TRUE.

verbose

Logical. If TRUE, prints information about the process. Default is TRUE.

project

Character scalar defining the project name. If NULL, inferred from DESCRIPTION file (Package field).

env

Environment of the datalake to use. Must be "prod" or "test". Defaults to "prod". "prod" writes to g6tr-dl, "test" to g6tr-dl-test.

Value

Invisibly returns the full S3 key written.

Details

Provides a consistent interface for storing model outputs, estimates, and other analytical results, automatically handling entity naming and optional tagging (e.g., name, version, wave).

Examples

if (FALSE) { # \dontrun{
# Minimal example
dl_write_result(
  x = model_results,
  result_type = "conjoint",
  env = "test"
)
} # }