Write: Write object and capture file information

Description Usage Arguments Details Value Examples

Description

Write object and capture file information

Usage

1
2
Write(obj = NULL, file.name = "data.csv", description = "Result file",
  write.fcn = guessWriteFcn(file.name), date = FALSE, ...)

Arguments

obj

object to write

file.name

file to write to the source "Result" directory

description

describes object to write

write.fcn

function for writing file of object type

date

logical for adding date to filename

...

arguments passed to write.fcn

Details

Main writing function for adapr to use in the body of the program. This is a wrapper function for Write.cap. Write dependencies of the script are captured with this function. Write will guess which function to use, but the use can specify any function that writes an R object to a file. The ‘.rda’ suffix will write so that loadFlex can load the object within another R script in the same project.

Value

File information list

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
# Within an R script:
source_info <- create_source_file_dir("adaprHome","tree_controller.R")
# Inside R script body:
write.csv(cars,file.path(source_info$results.dir,"test.csv"))
Write(cars,"cars.csv","cars dataframe")
# To examine effect:
showResults()  

## End(Not run) 

adapr documentation built on May 1, 2019, 7:05 p.m.