From 70e28d0f3b261baaabf6e0008a6d3f13f093cc19 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 2 Apr 2015 17:26:25 +0530 Subject: bug fixes and updated documentation --- R/detrend.R | 2 +- R/readData.R | 14 +++++++------- R/tf.R | 5 ----- 3 files changed, 8 insertions(+), 13 deletions(-) (limited to 'R') 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") -- cgit