-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMetaFile.R
More file actions
26 lines (23 loc) · 759 Bytes
/
MetaFile.R
File metadata and controls
26 lines (23 loc) · 759 Bytes
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
meta.file <- setRefClass("meta.file", fields = list(
df = "data.frame"),
methods = list(
initialize = function(df_) {
columns <- c("subject", "predicate", "object")
if (missing(df_)) {
df_ <- data.frame(matrix(nrow = 0, ncol = length(columns)))
colnames(df_) = columns
}
df <<- df_
},
add_model_information = function(predicate, object) {
triple <- list(subject="model", predicate=predicate, object=object)
df <<- rbind(df, triple)
},
add_free_information = function(subject, predicate, object) {
triple <- list(subject=subject, predicate=predicate, object=object)
df <<- rbind(df, triple)
},
as.data.frame = function() {
return(df)
}
))