Learn R Programming

adapr (version 2.0.0)

Write: Write object and capture file information

Description

Write object and capture file information

Usage

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

Value

File information list

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.

Examples

Run this code
# 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()  
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab