save_debug_data: Save data for debug

Description Usage Arguments Details Value See Also Examples

View source: R/utils_dev.R

Description

Save data in RDS file for debug if on_debug() is TRUE.

Usage

1
save_debug_data(data, output_file, overwrite = FALSE)

Arguments

data

A R obj to save.

output_file

A character of name of output file

overwrite

A logical to overwrite existed output_file or not. Default FALSE means not to overwrite existed output file.

Details

If on_debug() is TRUE, save_debug_data will save data and return the path of saved file, otherwise it will save nothing and return NULL.

The saved data is located in app/temp directory with name like "outputfile_(YYYY-MM-DD).RDS". It will overwrite existed file if overwrite is TRUE, otherwise it will create a new file with a name with serial numbers, like "outputfile_(YYYY-MM-DD)_1.RDS".

Value

A character of path of output file saved or NULL.

See Also

Other utils_dev: add_analysis_module(), add_shiny_module(), debug_mode

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 

# Step1, put save_debug_data() at lines where to save data for debug
result <- foo()
save_debug_data(result, output_file = "result_data")

# Step2, activate debug mode if you want to store data for debug
enable_debug()

# Step3, deactivate debug mode if you want run app normally
disable_debug()


## End(Not run)

chriszheng2016/zstexplorer documentation built on June 13, 2021, 9:47 a.m.