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.'))
}
Run the code above in your browser using DataLab