Description Usage Arguments Value Examples
read file and convert the code which uses to flatten code
1 2 | demagrittr_source(in_, out_, mode = c("eager", "lazy", "promise"),
ask = TRUE)
|
in_ |
file path of input. |
out_ |
file path of output. |
mode |
transformed mode. |
ask |
ask to overwrite when 'out_“ already exists |
no return. side effect on a file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | tmp_dir <- tempdir()
in_path <- file.path(tmp_dir, "test_in.r")
out_path <- file.path(tmp_dir, "test_out.r")
writeLines(
"
x <- data.frame(a = 1:5, b = 6:10)
y <- x %>%
select(b) %>%
filter(b >= 8)
", in_path)
demagrittr_source(in_path, out_path, ask=FALSE)
# input file
cat(paste0(readLines(in_path), collapse="\n"))
# output file
cat(paste0(readLines(out_path), collapse="\n"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.