Tom and Bill--
Thanks! Both excellent solutions.
--Chris
Christopher W. Ryan, MD, MS
cryanatbinghamtondotedu
Early success is a terrible teacher. You’re essentially being rewarded
for a lack of preparation, so when you find yourself in a situation
where you must prepare, you can’t do it. You do
You could change the x component of density's output back into a Date object
and let plot choose a Date axis in its usual way. E.g.,
> den <- density(as.numeric(dd))
> den$x <- as.Date(den$x, origin=as.Date("1970-01-01"))
> plot(den$x, den$y)
(You probably will also want to normalize the y c
I have the dates of occurence of a repetitive event. I would like to
plot the density of these events, as well as their specific temporal
location. This is as far as I have gotten:
# generate some sample data: dates in 2014
random.dates <- sample(1:31, 100, replace=TRUE)
random.months <- sample(1
plot(density(as.numeric(dd)),
axes=FALSE,
xlim=c(as.numeric(as.Date("2014-01-01")),
as.numeric(as.Date("2014-12-30")))
rug(as.numeric(dd))
axis(side=1,
at=seq(from=as.numeric(as.Date('2014-01-01')),
to=as.numeric(as.Date('2014-12-1')),length.out=12),
lab
4 matches
Mail list logo