# NOT RUN {
if(requireNamespace("IFCdata", quietly = TRUE)) {
## use a daf file
file_daf <- system.file("extdata", "example.daf", package = "IFCdata")
daf <- ExtractFromDAF(fileName = file_daf)
## copy 1st population from existing daf
pop <- daf$pops[[1]]
if(length(pop) != 0) {
pop_copy <- pop
## modify name, obj and type of copied population
pop_copy$name <- paste0(pop_copy$name,"_copy")
pop_copy$obj <- (which(pop_copy$obj)-1)[1]
pop_copy$type <- "T"
## create new object with this new population
dafnew <- data_add_pops(obj = daf, pops = list(pop_copy))
}
} 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