[R] as.Date / size of par
ggrothendieck at gmail.com
Mon Apr 17 15:36:54 CEST 2006
# test data
y <- 0:1000 # values
dd <- Sys.Date() + y # Dates
# create zoo object, aggregate it by year using last value and plot it
z <- zoo(y, dd)
yr <- function(x) as.POSIXlt(x)$year + 1900
# or, yr <- function(x) as.numeric(format(x, "%Y"))
z.yr <- aggregate(z, yr, tail, 1)
plot(z.yr, type = "o")
Also see R News 4/1 help desk article for more on dates and
see the zoo vignette for more on zoo:
On 4/17/06, Stefan Semmeling <trittihn at web.de> wrote:
> dear list,
> i have a problem plotting revenue against the date.
> the str. of date looks like:
> Class 'Date' num [1:10493] -3649 -3648 -3647 -3646 -3643 ...
> the head looks like:
>  "1960-01-05" "1960-01-06" "1960-01-07" "1960-01-08" "1960-01-11"
>  "1960-01-12"
> i´d like to plot it against the years, but can´t figure out how that works.
> an other problem is the size of par.
> i want to put two graphics in one sheet. that works just fine.
> but when i tried to scale the entire sheet i failed.
> layout(matrix(c(1,2)), heights = c(4,3))
> is what i got, but i want the height to be longer than the width
> of the entire graphical output.
> any help is wellcome :-)
> thank you
> [[alternative HTML version deleted]]
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
More information about the R-help