summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSuraj Yerramilli2015-08-20 17:32:07 +0530
committerSuraj Yerramilli2015-08-20 17:32:07 +0530
commit1dadd97b87e44b99cadc8eca7fb41a3da78218ff (patch)
treea8d75858b2161486c198da84bcf0237534033b19
parent89d9f5b138c2424656e416da5b96e26852c31d9f (diff)
downloadSysID-R-code-1dadd97b87e44b99cadc8eca7fb41a3da78218ff.tar.gz
SysID-R-code-1dadd97b87e44b99cadc8eca7fb41a3da78218ff.tar.bz2
SysID-R-code-1dadd97b87e44b99cadc8eca7fb41a3da78218ff.zip
Simplified the detrend function
-rw-r--r--R/preprocess.R8
-rw-r--r--man/detrend.Rd8
2 files changed, 8 insertions, 8 deletions
diff --git a/R/preprocess.R b/R/preprocess.R
index 8751645..bbe5f52 100644
--- a/R/preprocess.R
+++ b/R/preprocess.R
@@ -3,7 +3,7 @@
#' Removes the offsets or linear trends in each of the input and output matrices.
#'
#' @param data an object of class \code{idframe}
-#' @param type trend type - "constant" or "linear". (Default: \code{"linear"})
+#' @param type trend type - "constant" or "linear". (Default: \code{"constant"})
#'
#' @return
#' A list containing the following elements
@@ -18,15 +18,15 @@
#'
#' @examples
#' data(cstr)
-#' fit <- detrend(cstr) # remove linear trends
+#' fit <- detrend(cstr,type="linear") # remove linear trends
#' Zdetrend <- predict(fit) # get the detrended data
#'
-#' demean <- detrend(cstr,type="constant") # remove offsets
+#' demean <- detrend(cstr) # remove offsets
#' Zcent <- predict(demean) # get the centered data
#'
#' @seealso \code{\link{predict.detrend}}, \code{\link[stats]{lm}}
#' @export
-detrend <- function(data,type=c("constant","linear")[2]){
+detrend <- function(data,type=c("constant","linear")[1]){
if(!(type %in% c("constant","linear"))){
stop("Error: Invalid trend type")
diff --git a/man/detrend.Rd b/man/detrend.Rd
index f567247..d517b49 100644
--- a/man/detrend.Rd
+++ b/man/detrend.Rd
@@ -4,12 +4,12 @@
\alias{detrend}
\title{Remove offsets and linear trends}
\usage{
-detrend(data, type = c("constant", "linear")[2])
+detrend(data, type = c("constant", "linear")[1])
}
\arguments{
\item{data}{an object of class \code{idframe}}
-\item{type}{trend type - "constant" or "linear". (Default: \code{"linear"})}
+\item{type}{trend type - "constant" or "linear". (Default: \code{"constant"})}
}
\value{
A list containing the following elements
@@ -27,10 +27,10 @@ Removes the offsets or linear trends in each of the input and output matrices.
}
\examples{
data(cstr)
-fit <- detrend(cstr) # remove linear trends
+fit <- detrend(cstr,type="linear") # remove linear trends
Zdetrend <- predict(fit) # get the detrended data
-demean <- detrend(cstr,type="constant") # remove offsets
+demean <- detrend(cstr) # remove offsets
Zcent <- predict(demean) # get the centered data
}
\seealso{