SCM

SCM Repository

[latticeextra] Diff of /pkg/R/timeseries.R
ViewVC logotype

Diff of /pkg/R/timeseries.R

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 54, Thu Dec 3 02:09:49 2009 UTC revision 60, Wed Dec 16 04:45:15 2009 UTC
# Line 1  Line 1 
1    
   
 xyplot.ts <-  
     function(x, data = NULL, type = 'l',  
              auto.key = TRUE,  
              cut = FALSE,  
              default.scales = list(),  
              ...)  
     ## TODO: a way to specify styles for each series in 'x'? (by name?)  
     ## TODO: and allow series in 'x' to be grouped into separate panels?  
 {  
     stopifnot(is.null(data))  
     ocall <- sys.call(sys.parent())  
     data <- as.data.frame(x)  
     nm <- names(data)  
     unm <- make.names(c(nm, "Time"), unique = TRUE)  
     names(data) <- unm[-length(unm)]  
     tnm <- unm[length(unm)]  
     data[[tnm]] <- as.vector(time(x))  
     if (is.logical(cut) && cut) cut <- list()  
     if (is.list(cut))  
     {  
         ecargs <- list(x = data[[tnm]])  
         ecargs <- lattice:::updateList(ecargs, cut)  
         data[[tnm]] <- do.call(equal.count, ecargs)  
         ## tnm will work as numeric x-variable too  
         form <-  
             as.formula(sprintf("%s ~ %s | %s",  
                                paste(lapply(unm[-length(unm)], as.name), collapse = "+"),  
                                tnm, tnm))  
         default.scales <-  
             lattice:::updateList(list(x = list(relation = "sliced")),  
                                  default.scales)  
     }  
     else  
     {  
         form <-  
             as.formula(sprintf("%s ~ %s",  
                                paste(lapply(unm[-length(unm)], as.name), collapse = "+"),  
                                tnm))  
     }  
     if (is.logical(auto.key) && auto.key) auto.key <- list()  
     if (is.list(auto.key))  
         auto.key <-  
             modifyList(list(lines = TRUE, points = FALSE),  
                        auto.key)  
     ans <- xyplot(form, data = data, type = type, auto.key = auto.key,  
                   default.scales = default.scales, ...)  
     ans$call <- ocall  
     ans  
 }  
   
 llines.ts <-  
     function(x, y = NULL, ...)  
 {  
     if (!is.null(y)) {  
         llines(as.vector(x), y = y, ...)  
     } else {  
         llines(as.vector(time(x)), y = as.vector(x), ...)  
     }  
 }  
   
   
2  xyplot.stl <-  xyplot.stl <-
3      function(x, data = NULL,      function(x, data = NULL,
4               outer = TRUE,               outer = TRUE,

Legend:
Removed from v.54  
changed lines
  Added in v.60

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge