diff options
author | Suraj Yerramilli | 2015-06-05 15:38:27 +0530 |
---|---|---|
committer | Suraj Yerramilli | 2015-06-05 15:38:27 +0530 |
commit | 6dee73302e3bd1c59f617b43fabc6cb611321650 (patch) | |
tree | 10a00079e63c58180b2ea683620c632a916cdeed | |
parent | 061d59641948d9e64c1f2dd79de85a98fe18bbed (diff) | |
download | SysID-R-code-6dee73302e3bd1c59f617b43fabc6cb611321650.tar.gz SysID-R-code-6dee73302e3bd1c59f617b43fabc6cb611321650.tar.bz2 SysID-R-code-6dee73302e3bd1c59f617b43fabc6cb611321650.zip |
Changes in the read function to reflect changes in the idframe constructor
-rw-r--r-- | R/readData.R | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/R/readData.R b/R/readData.R index 95792f0..e9004e6 100644 --- a/R/readData.R +++ b/R/readData.R @@ -6,7 +6,7 @@ #' @param freqData a logical value indicating whether the file contains the list of #' frequencies. If \code{TRUE}, they need to be present in the first column. #' (Default: \code{idframe}) -#' @param ninputs the number of input columns. (Default: 1) +#' @param ninputs the number of input columns. (Default: NULL) #' @param type indicates the domain of the data (Default:\code{"time"}) #' @param Ts sampling interval (Default: 1) #' @param tUnit Time Unit (Default: "seconds") @@ -22,7 +22,7 @@ #' data <- read.idframe(cstrData,ninputs=1,type="time",Ts= 1,tUnit="min") #' #' @export -read.idframe <- function(data,freqData=FALSE,ninputs=1, +read.idframe <- function(data,freqData=FALSE,ninputs=NULL, type=c("time","freq")[1],Ts = 1,tUnit="sec"){ if((type=="freq") && (freqData)){ @@ -35,9 +35,12 @@ read.idframe <- function(data,freqData=FALSE,ninputs=1, frequencies=frequencies,tUnit=tUnit) } else{ - - inputs <- data[,1:ninputs,drop=F] - outputs <- data[,seq(ninputs+1,dim(data)[2],by=1),drop=F] + outIndex <- 1:dim(data)[2]; inputs <- NULL + if(!is.null(ninputs)){ + inputs <- data[,1:ninputs,drop=F] + outIndex <- seq(ninputs+1,dim(data)[2] + } + outputs <- data[,outIndex,by=1),drop=F] out <- idframe(output=outputs,input=inputs,type=type,Ts=Ts,tUnit=tUnit) } |