plot.cmpt.2 {heR.IndoorAir}R Documentation

~~function to do ... ~~

Description

~~ A concise (1-5 lines) description of what the function does. ~~

Usage

plot.cmpt.2(x, params = FALSE, pplots = c("v", "s", "p", "etaii", "etaix", "dep", "des", "e"), air.labels = NULL, surf.labels = NULL, f.labels = NULL, v.labels = NULL, s.labels = NULL, e.labels = NULL, dep.labels = NULL, des.labels = NULL, p.labels = NULL, etaii.labels = NULL, etaix.labels = NULL, mainair = "Multi-Compartment Model: Air Concentrations", mainsurf = "Multi-Compartment Model: Surface Concentrations", amainair = "Multi-Compartment Model: Time-Averaged Air Conc.", amainsurf = "Multi-Compartment Model: Time-Averaged Surf Conc.", pmain = "Multi-Compartment Model: Parameter Values", type = "l", lwd = 3, as.table = TRUE, ...)

Arguments

x ~~Describe x here~~
params ~~Describe params here~~
pplots ~~Describe pplots here~~
air.labels ~~Describe air.labels here~~
surf.labels ~~Describe surf.labels here~~
f.labels ~~Describe f.labels here~~
v.labels ~~Describe v.labels here~~
s.labels ~~Describe s.labels here~~
e.labels ~~Describe e.labels here~~
dep.labels ~~Describe dep.labels here~~
des.labels ~~Describe des.labels here~~
p.labels ~~Describe p.labels here~~
etaii.labels ~~Describe etaii.labels here~~
etaix.labels ~~Describe etaix.labels here~~
mainair ~~Describe mainair here~~
mainsurf ~~Describe mainsurf here~~
amainair ~~Describe amainair here~~
amainsurf ~~Describe amainsurf here~~
pmain ~~Describe pmain here~~
type ~~Describe type here~~
lwd ~~Describe lwd here~~
as.table ~~Describe as.table here~~
... ~~Describe ... here~~

Details

~~ If necessary, more details than the __description__ above ~~

Value

~Describe the value returned If it is a LIST, use

comp1 Description of 'comp1'
comp2 Description of 'comp2'

...

Warning

....

Note

~~further notes~~

Author(s)

~~who you are~~

References

~put references to the literature/web site here ~

See Also

~~objects to See Also as ~~fun~~, ~~~

Examples

##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--    or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function(x, params=FALSE,
         pplots=c("v","s","p","etaii","etaix","dep","des","e"), 
         air.labels=NULL, surf.labels=NULL,
         f.labels=NULL, v.labels=NULL, s.labels=NULL, e.labels=NULL,
         dep.labels=NULL, des.labels=NULL, p.labels=NULL,
         etaii.labels=NULL, etaix.labels=NULL,
         mainair="Multi-Compartment Model: Air Concentrations",
         mainsurf="Multi-Compartment Model: Surface Concentrations",
         amainair="Multi-Compartment Model: Time-Averaged Air Conc.",
         amainsurf="Multi-Compartment Model: Time-Averaged Surf Conc.",
         pmain="Multi-Compartment Model: Parameter Values",
         type="l", lwd=3, as.table=TRUE, ...)
{

# Plot an arbitrary "cmpt" multi-compartment model output object

# Updated to deal with surface concentrations/params in cmpt.2.
#                ---May 13, 2003.

require(lattice)

ndim <- NCOL(x$airconc)

# Plot instantaneous air concentrations
if (is.null(air.labels)) air.labels <- paste("Air Compartment: ",1:ndim)
data <- data.frame(Conc=unlist(x$airconc),Time=rep(x$times,ndim),
          Cmpt=gl(ndim,length(x$times), labels=air.labels))
if (!is.null(dev.list())) dev.set(dev.list()[1])
print(xyplot(Conc ~ Time | Cmpt, data = data, type=type, lwd=lwd, main=mainair, as.table=as.table, ...))

# Plot time-averaged air concentrations
if (x$other$do.ave) {
  if (is.null(air.labels)) air.labels <- paste("Air Compartment: ",1:ndim)
  x$airave <- rbind(x$airave[1,], x$airave)
  data <- data.frame(Conc=unlist(x$airave),Time=rep(x$times,ndim),
          Cmpt=gl(ndim,length(x$times), labels=air.labels))
  dev.set(dev.next())
  print(xyplot(Conc ~ Time | Cmpt, data = data, type="S", lwd=lwd, main=amainair, as.table=as.table, ...))
  }

# Plot instantaneous surface concentrations
if (is.null(surf.labels)) surf.labels <- paste("Surface: ",1:ndim)
data <- data.frame(Conc=unlist(x$surfconc),Time=rep(x$times,ndim),
          Cmpt=gl(ndim,length(x$times), labels=surf.labels))
if (!is.null(dev.list())) dev.set(dev.list()[1])
dev.set(dev.next())
print(xyplot(Conc ~ Time | Cmpt, data = data, type=type, lwd=lwd, main=mainsurf, as.table=as.table, ...))

# Plot time-averaged surface concentrations
if (x$other$do.ave) {
  if (is.null(surf.labels)) surf.labels <- paste("Surface: ",1:ndim)
  x$airave <- rbind(x$surfave[1,], x$surfave)
  data <- data.frame(Conc=unlist(x$surfave),Time=rep(x$times,ndim),
          Cmpt=gl(ndim,length(x$times), labels=surf.labels))
  dev.set(dev.next())
  print(xyplot(Conc ~ Time | Cmpt, data = data, type="S", lwd=lwd, main=amainsurf, as.table=as.table, ...))
  }

# Plot parameters: e, v, s, dep, des, f, p, etaii, etaix
#  Note: a0, s0 are *not* plotted (since they are not time-varying)

if (params) {
  if (is.null(etaii.labels))
     etaii.labels <- paste("Filtration ",1:ndim,":",1:ndim,sep="")
  if (is.null(etaix.labels))
     etaix.labels <- paste("Filtration ",c(1:ndim,"Out"),":X",sep="")
  if (is.null(e.labels))
     e.labels <- paste("Emissions ",1:ndim,sep="")
  if (is.null(v.labels))
     v.labels <- paste("Volume ",1:ndim,sep="")
  if (is.null(s.labels))
     v.labels <- paste("Surface Area ",1:ndim,sep="")
  if (is.null(dep.labels))
     dep.labels <- paste("Deposition/Sorption ",1:ndim,sep="")
  if (is.null(des.labels))
     des.labels <- paste("Desorption ",1:ndim,sep="")
  if (is.null(p.labels))
     p.labels <- paste("Penetration (Out->In) ",1:ndim,sep="")
 
  if (is.null(f.labels)) {
    f.labels<-expand.grid(factor(1:(ndim+2),
                            labels=c(1:ndim,"Out","X")),
                          factor(1:(ndim+2),
                            labels=c(1:ndim,"Out","X")))
    f.labels <- paste("Flow ",f.labels[[2]],":",f.labels[[1]], sep="") 
  }

  labels <- list(etaii=etaii.labels, etaix=etaix.labels, p=p.labels,
                 d=d.labels, v=v.labels, e=e.labels)

  # Plot air flows

  if ("f" 
    dev.set(dev.next()) 
    data <- data.frame(Value=as.vector(aperm(x$param$f, perm=c(3,2,1))),
              Time=rep(x$times,(ndim+2)^2),
              Param=gl((ndim+2)^2, length(x$times),
                      labels=f.labels))
    print(xyplot(Value ~ Time | Param, data = data, type=type, lwd=lwd, main=pmain, as.table=as.table, ...)) 
  }

  # Plot other time-varying parameters

  for (i in sort(names(x$param))) {
      if (i != "f" & i != "a0" & i != "s0" & i 
        dev.set(dev.next())
        n<-NROW(x$param[[i]])
        data <- data.frame(Value=as.vector(t(x$param[[i]])),
                  Time=rep(x$times,n),
                  Param=gl(n, length(x$times),
                            labels=labels[[i]]))
        print(xyplot(Value ~ Time | Param, data = data, type=type, lwd=lwd, main=pmain, as.table=as.table, ...))
      }
  }

  

[Package heR.IndoorAir version 0.0.3 Index]