diff options
author | unknown | 2015-04-02 17:26:25 +0530 |
---|---|---|
committer | unknown | 2015-04-02 17:26:25 +0530 |
commit | 70e28d0f3b261baaabf6e0008a6d3f13f093cc19 (patch) | |
tree | f59712b49a96420a9509e01ff9c94d89ee32d238 /R/readData.R | |
parent | 0bc263264901d09cce981f701a0f0eb3bc0b9c15 (diff) | |
download | SysID-R-code-70e28d0f3b261baaabf6e0008a6d3f13f093cc19.tar.gz SysID-R-code-70e28d0f3b261baaabf6e0008a6d3f13f093cc19.tar.bz2 SysID-R-code-70e28d0f3b261baaabf6e0008a6d3f13f093cc19.zip |
bug fixes and updated documentation
Diffstat (limited to 'R/readData.R')
-rw-r--r-- | R/readData.R | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/R/readData.R b/R/readData.R index eac03a5..95792f0 100644 --- a/R/readData.R +++ b/R/readData.R @@ -28,16 +28,16 @@ read.idframe <- function(data,freqData=FALSE,ninputs=1, if((type=="freq") && (freqData)){ frequencies <- data[,1] # the first column must contain frequencies - inputs <- data[,seq(2,length.out=ninputs,by=1)] - outputs <- data[,seq((ninputs+2),dim(data)[2],by=1)] + inputs <- data[,seq(2,length.out=ninputs,by=1),drop=F] + outputs <- data[,seq((ninputs+2),dim(data)[2],by=1),drop=F] out <- idframe(output=outputs,input=inputs,type=type,Ts=Ts, frequencies=frequencies,tUnit=tUnit) } else{ - inputs <- data[,1:ninputs] - outputs <- data[,seq(ninputs+1,dim(data)[2],by=1)] + inputs <- data[,1:ninputs,drop=F] + outputs <- data[,seq(ninputs+1,dim(data)[2],by=1),drop=F] out <- idframe(output=outputs,input=inputs,type=type,Ts=Ts,tUnit=tUnit) } @@ -78,7 +78,7 @@ read.idframe <- function(data,freqData=FALSE,ninputs=1, #' @examples #' dataMatrix <- data.frame(matrix(rnorm(1000),ncol=5)) #' colnames(dataMatrix) <- c("u1","u2","y1","y2","y3") -#' write.csv(dataMatrix,file="test.csv",row.names=F) +#' write.csv(dataMatrix,file="test.csv",row.names=FALSE) #' #' data <- read.table.idframe("test.csv",ninputs=2,tUnit="min") #' @@ -134,7 +134,7 @@ read.table.idframe <- function(file,header=TRUE,sep=",",ninputs=1, #' library(xlsx) #' dataMatrix <- data.frame(matrix(rnorm(1000),ncol=5)) #' colnames(dataMatrix) <- c("u1","u2","y1","y2","y3") -#' write.xlsx2(dataMatrix,file="test.xlsx",row.names=F) +#' write.xlsx2(dataMatrix,file="test.xlsx",row.names=FALSE) #' #' data <- read.xls.idframe("test.xlsx","Sheet1",ninputs=2,tUnit="min") #' @@ -149,7 +149,7 @@ read.xls.idframe <- function(file,sheetName,header=TRUE,ninputs=1, # Read from file into an R data.frame dat <- read.xlsx2(file=file,sheetName=sheetName,header=header,...) l <- as.list(dat) - dat <- as.data.frame(l,as.numeric) + dat <- as.data.frame(sapply(l,as.numeric)) # read from dataframe and return idframe object out <- read.idframe(dat,ninputs=ninputs,type=type,Ts = Ts, |