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 60, Wed Dec 16 04:45:15 2009 UTC revision 65, Mon Dec 21 06:38:19 2009 UTC
# Line 1  Line 1 
1    
2    
3    xyplot.ts <-
4        function(x, data = NULL, type = 'l',
5                 auto.key = TRUE,
6                 cut = FALSE,
7                 default.scales = list(),
8                 ...)
9        ## TODO: a way to specify styles for each series in 'x'? (by name?)
10        ## TODO: and allow series in 'x' to be grouped into separate panels?
11    {
12        stopifnot(is.null(data))
13        ocall <- sys.call(sys.parent())
14        data <- as.data.frame(x)
15        nm <- names(data)
16        unm <- make.names(c(nm, "Time"), unique = TRUE)
17        names(data) <- unm[-length(unm)]
18        tnm <- unm[length(unm)]
19        data[[tnm]] <- as.vector(time(x))
20        if (is.logical(cut) && cut) cut <- list()
21        if (is.list(cut))
22        {
23            ecargs <- list(x = data[[tnm]])
24            ecargs <- lattice:::updateList(ecargs, cut)
25            data[[tnm]] <- do.call(equal.count, ecargs)
26            ## tnm will work as numeric x-variable too
27            form <-
28                as.formula(sprintf("%s ~ %s | %s",
29                                   paste(lapply(unm[-length(unm)], as.name), collapse = "+"),
30                                   tnm, tnm))
31            default.scales <-
32                lattice:::updateList(list(x = list(relation = "sliced")),
33                                     default.scales)
34        }
35        else
36        {
37            form <-
38                as.formula(sprintf("%s ~ %s",
39                                   paste(lapply(unm[-length(unm)], as.name), collapse = "+"),
40                                   tnm))
41        }
42        if (is.logical(auto.key) && auto.key) auto.key <- list()
43        if (is.list(auto.key))
44            auto.key <-
45                modifyList(list(lines = TRUE, points = FALSE),
46                           auto.key)
47        ans <- xyplot(form, data = data, type = type, auto.key = auto.key,
48                      default.scales = default.scales, ...)
49        ans$call <- ocall
50        ans
51    }
52    
53    llines.ts <-
54        function(x, y = NULL, ...)
55    {
56        if (!is.null(y)) {
57            llines(as.vector(x), y = y, ...)
58        } else {
59            llines(as.vector(time(x)), y = as.vector(x), ...)
60        }
61    }
62    
63    
64  xyplot.stl <-  xyplot.stl <-
65      function(x, data = NULL,      function(x, data = NULL,
66               outer = TRUE,               outer = TRUE,

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

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