data_to_DAF {IFC} | R Documentation |
DAF File Writer
Description
Writes an 'IFC_data' object to a daf file
Usage
data_to_DAF(
obj,
write_to,
viewing_pop = "All",
overwrite = FALSE,
binary = TRUE,
endianness = .Platform$endian,
display_progress = TRUE,
verbose = FALSE,
fullname = TRUE,
cifdir = dirname(obj$fileName),
ntry = +Inf,
...
)
Arguments
obj |
an 'IFC_data' object extracted with features extracted. |
write_to |
pattern used to export file.
Placeholders, like "%d/%s_fromR.%e", will be substituted: |
viewing_pop |
Character String. Allow user to change displayed population. Default is 'All'. |
overwrite |
whether to overwrite file or not. Default is FALSE.
Note that if TRUE, it will overwrite exported file if path of 'obj$fileName' and deduced from 'write_to' arguments are different.
Otherwise, you will get an error saying that overwriting source file is not allowed. |
binary |
whether to write object to file in binary mode or not. Default is TRUE. |
endianness |
The endian-ness ("big" or "little") of the target system for the file. Default is .Platform$endian. |
display_progress |
whether to display a progress bar. Default is TRUE. |
verbose |
whether to display information (use for debugging purpose). Default is FALSE. |
fullname |
whether to export daf file with full name of its corresponding cif, if found. Default is TRUE. If cif can't be found, daf file will be exported with the original cif file name. |
cifdir |
the path of the directory to initially look to cif file. Default is dirname(obj$fileName). Only apply when 'fullname' is set to TRUE. |
ntry |
number of times |
... |
other arguments to be passed. |
Value
It invisibly returns full path of exported file.
Examples
if(requireNamespace("IFCdata", quietly = TRUE)) {
tmp <- tempdir(check = TRUE)
## use a daf file
file_daf <- system.file("extdata", "example.daf", package = "IFCdata")
daf <- ExtractFromDAF(fileName = file_daf)
## add a new population to daf
dafnew <- data_add_pops(daf, list(buildPopulation(name = "test", type = "T", obj = 0)))
## export obj to file using binary mode
data_to_DAF(obj = dafnew, write_to = paste0(tmp, "\\test_bin.daf"),
overwrite = TRUE, binary = TRUE)
## exporting to non binary mode
data_to_DAF(obj = dafnew, write_to = paste0(tmp, "\\test_notbin.daf"),
overwrite = TRUE, binary = FALSE)
} else {
message(sprintf('Please run `install.packages("IFCdata", repos = "%s", type = "source")` %s',
'https://gitdemont.github.io/IFCdata/',
'to install extra files required to run this example.'))
}