-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwrite_cap.R
27 lines (19 loc) · 896 Bytes
/
write_cap.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#' Write data and capture the file information within dependency object
#' @param obj object to write, if null then open graphics device
#' @param file.info file information list
#' @param source_info source information list
#' @return file.info file information returned
#' @export
#'
Write.cap <- function(obj=NULL,file.info,write.fcn,source_info,...){
# write obj to file using write.fcn
# update dependency.file object in filesystem
# ... options to write.fcn
if(is.null(obj)){
write.fcn(file.info[["fullname"]],...)
# print(c("wrote",file))
}else{write.fcn(obj,file=file.info[["fullname"]],...)}
df.update <- data.frame(target.file=file.info[["file"]],target.path=file.info[["path"]],target.description=file.info[["description"]],dependency="out",stringsAsFactors=FALSE)
source_info$dependency$update(df.update)
return(file.info)
} # Write.cap