summaryrefslogtreecommitdiff
path: root/R/ioNamesData.R
blob: a17cca52420de4f687c946f0ce0216555a0b45f8 (plain)
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
#' @export
nInputSeries <- function(data) ncol(data$input)

#' @export
nOutputSeries <- function(data) ncol(data$output)

#' @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))
}

#' @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
}