View source: R/add_synthetic.R
| add_synthetic | R Documentation | 
This function adds a user-specified synthetic data resource for public use to a WORCS project with closed data.
add_synthetic(
  data,
  synthetic_name = paste0("synthetic_", original_name),
  original_name,
  worcs_directory = ".",
  verbose = TRUE,
  ...
)
| data | A  | 
| synthetic_name | Character, naming the file synthetic data should be
written to. By
default, prepends  | 
| original_name | Character, naming an existing data resource in the WORCS
project with which to associate the synthetic  | 
| worcs_directory | Character, indicating the WORCS project directory to
which to save data. The default value  | 
| verbose | Logical. Whether or not to print status messages to the console. Default: TRUE | 
| ... | Additional arguments passed to and from functions. | 
Returns NULL invisibly. This
function is called for its side effects.
open_data closed_data save_data
# Create directory to run the example
old_wd <- getwd()
test_dir <- file.path(tempdir(), "add_synthetic")
dir.create(test_dir)
setwd(test_dir)
worcs:::write_worcsfile(".worcs")
# Prepare data
df <- iris[1:3, ]
# Run closed_data without synthetic
closed_data(df, codebook = NULL, synthetic = FALSE)
# Manually add synthetic
add_synthetic(df, original_name = "df.csv")
# Remove original from file and environment
file.remove("df.csv")
rm(df)
# See that load_data() now loads the synthetic file
load_data()
# Cleaning example directory
setwd(old_wd)
unlink(test_dir, recursive = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.