summaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
authorunknown2015-04-02 17:26:25 +0530
committerunknown2015-04-02 17:26:25 +0530
commit70e28d0f3b261baaabf6e0008a6d3f13f093cc19 (patch)
treef59712b49a96420a9509e01ff9c94d89ee32d238 /R
parent0bc263264901d09cce981f701a0f0eb3bc0b9c15 (diff)
downloadSysID-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')
-rw-r--r--R/detrend.R2
-rw-r--r--R/readData.R14
-rw-r--r--R/tf.R5
3 files changed, 8 insertions, 13 deletions
diff --git a/R/detrend.R b/R/detrend.R
index ff1fab2..2c42c90 100644
--- a/R/detrend.R
+++ b/R/detrend.R
@@ -76,7 +76,7 @@ detrend <- function(data,type=c("constant","linear")[2]){
#' @examples
#' data(cstr)
#' train <- dataSlice(cstr,end=5000) # subset the first 5000 indices
-#' test <- dataSlice(distill,start=6001) # subset from index 6001 till the end
+#' test <- dataSlice(cstr,start=6001) # subset from index 6001 till the end
#' fit <- detrend(train)
#' Ztrain <- predict(fit)
#' Ztest <- predict(fit,test)
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,
diff --git a/R/tf.R b/R/tf.R
index 350f4bd..f556e15 100644
--- a/R/tf.R
+++ b/R/tf.R
@@ -14,11 +14,6 @@ tf <- function(num=c(1),den=c(1),Ts=1){
return(out)
}
-#' Display the Transfer Function
-#'
-#' Printing method for objects inheriting from class \code{tf}
-#'
-#' @param G an object of class \code{tf}
#' @export
print.tf <- function(G){
cat("Transfer Function \nG(q^{-1}) = B(q^{-1})/A(q^{-1}) \n\n")