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 feature found in daf
feat_def <- daf$features_def[[1]]
if(length(feat_def) != 0) {
feat_def_copy <- feat_def
## modify name and value of copied features
feat_def_copy$name <- "copied_feature"
feat <- daf$features[, feat_def$name]
feat_copy <- feat
feat_copy <- feat_copy * 10
## create new object with this new feature
dafnew <- data_add_features(obj = daf, features = list(c(feat_def_copy, list(val = feat_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