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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
#' Number of series in input or output
#'
#' Number of series in input or output in a idframe object
#'
#'
#' @param data \code{idframe} object
#'
#' @aliases nOutputSeries
#'
#' @export
nInputSeries <- function(data) {
ifelse(is.null(data$input),0,ncol(data$input))
}
#' @export
nOutputSeries <- function(data) ncol(data$output)
#' Output or Input-data
#'
#' Extract output-data or input-data in idframe objects
#'
#' @param x \code{idframe} object
#' @param series the indices to extract
#'
#' @aliases inputData.idframe outputData outputData.idframe
#'
#' @export
inputData <- function(x,series) UseMethod("inputData")
#' @export
inputData.default <- function(x,series=NULL){
print("Not defined for this datatype")
}
#' @import tframe
#' @export
inputData.idframe <- function(x,series=seq(nInputSeries(x))){
if (is.null(x$input))
NULL
else selectSeries(x$input,series=series)
}
"inputData<-" <- function(x,value) UseMethod("inputData<-")
"inputData<-.idframe" <- function(x,value){
x$input <- value
x
}
#' @export
inputNames <- function(x) UseMethod("inputNames")
#' @export
inputNames.default <- function(x){
print("Not defined for this datatype")
}
#' @import tframe
#' @export
inputNames.idframe <- function(x){
seriesNames(inputData(x))
}
#' Extract or set series' names
#'
#' Extract or set names of series in input or output
#'
#' @param x \code{idframe} object
#' @param value vector of strings
#'
#' @aliases inputNames inputNames<-.idframe outputNames outputNames outputNames<- outputNames<-.idframe
#'
#' @export
"inputNames<-" <- function(x,value) UseMethod("inputNames<-")
#' @import tframe
#' @export
"inputNames<-.idframe" <- function(x,value){
seriesNames(inputData(x)) <- value
x
}
#' @export
outputData <- function(x,series) UseMethod("outputData")
#' @export
outputData.default <- function(x,series=NULL){
print("Not defined for this datatype")
}
#' @import tframe
#' @export
outputData.idframe <- function(x,series=seq(nOutputSeries(x))){
if (is.null(x$output))
NULL
else selectSeries(x$output,series=series)
}
"outputData<-" <- function(x,value) UseMethod("outputData<-")
"outputData<-.idframe" <- function(x,value){
x$output <- value
x
}
#' @export
outputNames <- function(x) UseMethod("outputNames")
#' @export
outputNames.default <- function(x){
print("Not defined for this datatype")
}
#' @import tframe
#' @export
outputNames.idframe <- function(x){
seriesNames(outputData(x))
}
#' @export
"outputNames<-" <- function(x,value) UseMethod("outputNames<-")
#' @import tframe
#' @export
"outputNames<-.idframe" <- function(x,value){
seriesNames(outputData(x)) <- value
x
}
|