save_code: Save generated code to a file

View source: R/save_code.R

save_codeR Documentation

Save generated code to a file

Description

Helper function that saves generated R code to a file. Does not overwrite existing files unless overwrite is explicitly set to TRUE.

Usage

save_code(code, file, overwrite = FALSE)

Arguments

code

character string with R code.

file

character string of the filename to be saved.

overwrite

whether the existing files should be overwritten.

Examples

## Not run: 
data <- data.frame(x = rnorm(100), y = rnorm(100))

code <- semproducible(data, formula="y ~ x")

save_code(code, "create_data.R")

save_code(code, "create_data.R", overwrite = TRUE)

## End(Not run)

peterdalle/semproducible documentation built on April 1, 2022, 8:47 p.m.