summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSuraj Yerramilli2017-01-06 17:26:19 -0600
committerSuraj Yerramilli2017-01-06 17:26:19 -0600
commit2c3b5027987486d0040501a3c254e106172eb5dc (patch)
treee8ac970779bf7985feb1c8f09f3e31f7bdccd8fc
parenta4cec768a4ed5fe4355a03340af544f2f8a6ba0c (diff)
downloadSysID-R-code-2c3b5027987486d0040501a3c254e106172eb5dc.tar.gz
SysID-R-code-2c3b5027987486d0040501a3c254e106172eb5dc.tar.bz2
SysID-R-code-2c3b5027987486d0040501a3c254e106172eb5dc.zip
S3 method consistency part-2
-rw-r--r--NAMESPACE2
-rw-r--r--R/idframe.R16
-rw-r--r--R/nonparam.R5
-rw-r--r--man/impulseest.Rd2
-rw-r--r--man/impulseplot.Rd (renamed from man/plot.impulseest.Rd)6
-rw-r--r--man/plot.idframe.Rd4
-rw-r--r--man/plot.idfrd.Rd4
7 files changed, 22 insertions, 17 deletions
diff --git a/NAMESPACE b/NAMESPACE
index 0ddac80..4e8b9a5 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -14,7 +14,6 @@ S3method(outputNames,idframe)
S3method(plot,estpoly)
S3method(plot,idframe)
S3method(plot,idfrd)
-S3method(plot,impulseest)
S3method(predict,estpoly)
S3method(print,estpoly)
S3method(print,idpoly)
@@ -45,6 +44,7 @@ export(idfrd)
export(idinput)
export(idpoly)
export(impulseest)
+export(impulseplot)
export(inputData)
export(inputNames)
export(iv)
diff --git a/R/idframe.R b/R/idframe.R
index c666b55..e619fca 100644
--- a/R/idframe.R
+++ b/R/idframe.R
@@ -57,6 +57,7 @@ idframe <- function(output,input=NULL,Ts = 1,start=0,end=NULL,
#' @param lwd line width, in millimeters(Default=\code{1})
#' @param main the plot title. (Default = \code{NULL})
#' @param size text size (Default = \code{12})
+#' @param \ldots additional arguments
#'
#' @examples
#' data(cstr)
@@ -65,7 +66,7 @@ idframe <- function(output,input=NULL,Ts = 1,start=0,end=NULL,
#' @import ggplot2 reshape2
#'
#' @export
-plot.idframe <- function(x,col="steelblue",lwd=1,main=NULL,size=12){
+plot.idframe <- function(x,col="steelblue",lwd=1,main=NULL,size=12,...){
loadNamespace("ggplot2")
if(nInputSeries(x)==0){
data <- outputData(x)
@@ -82,12 +83,12 @@ plot.idframe <- function(x,col="steelblue",lwd=1,main=NULL,size=12){
}
#' @export
-summary.idframe <- function(x){
- out_sum <- summary(outputData(x))
- in_sum <- summary(inputData(x))
+summary.idframe <- function(object,...){
+ out_sum <- summary(outputData(object))
+ in_sum <- summary(inputData(object))
- out <- list(out_sum=out_sum,in_sum=in_sum,Ts=deltat(x),
- unit=x$unit,nsample = dim(outputData(x))[1])
+ out <- list(out_sum=out_sum,in_sum=in_sum,Ts=deltat(object),
+ unit=object$unit,nsample = dim(outputData(object))[1])
class(out) <- "summary.idframe"
return(out)
@@ -190,6 +191,7 @@ idfrd <- function(respData,freq,Ts,spec=NULL,covData=NULL,
#' @param col a specification for the line colour (Default : \code{"
#' steelblue"})
#' @param lwd the line width, a positive number, defaulting to 1
+#' @param \ldots additional arguments
#'
#' @seealso \code{\link[ggplot2]{ggplot}}
#'
@@ -200,7 +202,7 @@ idfrd <- function(respData,freq,Ts,spec=NULL,covData=NULL,
#' @import ggplot2 reshape2 signal
#'
#' @export
-plot.idfrd <- function(x,col="steelblue",lwd=1){
+plot.idfrd <- function(x,col="steelblue",lwd=1,...){
loadNamespace("ggplot2")
nfreq <- dim(x$freq)[1]
mag <- 20*log10(Mod(x$resp))
diff --git a/R/nonparam.R b/R/nonparam.R
index 75b26b4..8e8e412 100644
--- a/R/nonparam.R
+++ b/R/nonparam.R
@@ -27,7 +27,7 @@
#' yk <- filter (uk,c(0.9,-0.4),method="recursive") + rnorm(1000,1)
#' data <- idframe(output=data.frame(yk),input=data.frame(uk))
#' fit <- impulseest(data)
-#' plot(fit)
+#' impulseplot(fit)
#'
#' @export
impulseest <- function(x,M=30,K=NULL,regul=F,lambda=1){
@@ -90,8 +90,7 @@ impulsechannel <- function(y,u,N,M,K=0,regul=F,lambda=1){
#' @import ggplot2
#'
#' @export
-plot.impulseest <- function(model,sd=2){
- loadNamespace("ggplot2")
+impulseplot <- function(model,sd=2){
plotseq <- seq(model$noutputs*model$ninputs)
g <- vector("list",model$nin*model$nout)
diff --git a/man/impulseest.Rd b/man/impulseest.Rd
index 4852d2c..4247a0f 100644
--- a/man/impulseest.Rd
+++ b/man/impulseest.Rd
@@ -33,7 +33,7 @@ uk <- rnorm(1000,1)
yk <- filter (uk,c(0.9,-0.4),method="recursive") + rnorm(1000,1)
data <- idframe(output=data.frame(yk),input=data.frame(uk))
fit <- impulseest(data)
-plot(fit)
+impulseplot(fit)
}
\references{
diff --git a/man/plot.impulseest.Rd b/man/impulseplot.Rd
index ac32797..0e7ced3 100644
--- a/man/plot.impulseest.Rd
+++ b/man/impulseplot.Rd
@@ -1,10 +1,10 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/nonparam.R
-\name{plot.impulseest}
-\alias{plot.impulseest}
+\name{impulseplot}
+\alias{impulseplot}
\title{Impulse Response Plots}
\usage{
-\method{plot}{impulseest}(model, sd = 2)
+impulseplot(model, sd = 2)
}
\arguments{
\item{model}{an object of class \code{impulseest}}
diff --git a/man/plot.idframe.Rd b/man/plot.idframe.Rd
index 2a34888..2e7948d 100644
--- a/man/plot.idframe.Rd
+++ b/man/plot.idframe.Rd
@@ -5,7 +5,7 @@
\title{Plotting idframe objects}
\usage{
\method{plot}{idframe}(x, col = "steelblue", lwd = 1, main = NULL,
- size = 12)
+ size = 12, ...)
}
\arguments{
\item{x}{an \code{idframe} object}
@@ -17,6 +17,8 @@
\item{main}{the plot title. (Default = \code{NULL})}
\item{size}{text size (Default = \code{12})}
+
+\item{\ldots}{additional arguments}
}
\description{
Plotting method for objects inherting from class \code{idframe}
diff --git a/man/plot.idfrd.Rd b/man/plot.idfrd.Rd
index d8f85af..435f6d7 100644
--- a/man/plot.idfrd.Rd
+++ b/man/plot.idfrd.Rd
@@ -4,7 +4,7 @@
\alias{plot.idfrd}
\title{Plotting idfrd objects}
\usage{
-\method{plot}{idfrd}(x, col = "steelblue", lwd = 1)
+\method{plot}{idfrd}(x, col = "steelblue", lwd = 1, ...)
}
\arguments{
\item{x}{An object of class \code{idframe}}
@@ -13,6 +13,8 @@
steelblue"})}
\item{lwd}{the line width, a positive number, defaulting to 1}
+
+\item{\ldots}{additional arguments}
}
\description{
Generates the bode plot of the given frequency response data. It uses the