Re: [R] time plotting problem

2007-11-14 Thread John Kane
Thank you Jim. That does give better results. I had not realised how complicated a question I was asking. Both yours and Jim Lemon's solutions work very nicely. I am still messing up the syntax with Gabour's approach. Thanks to all for the fast and valuable help. --- jim holtman <[EMAIL PRO

Re: [R] time plotting problem

2007-11-14 Thread John Kane
Thank you. Almost too fancy for the target user but very nice indeed. For some reason I had not thought of using ggplot2. --- hadley wickham <[EMAIL PROTECTED]> wrote: > Here's a version using reshape and ggplot: > > mydata <- > read.table("http://ca.geocities.com/jrkrideau/R/heartdata.txt";

Re: [R] time plotting problem

2007-11-14 Thread John Kane
Excellent, that looks very nice! I had not realised that plotrix would do that and I was definately hesitating to try and figure out how to do it myself. Any idea why all I was getting was a single date on the x-axis when just doing plot? --- Jim Lemon <[EMAIL PROTECTED]> wrote: > John Kan

Re: [R] time plotting problem

2007-11-14 Thread Jim Lemon
John Kane wrote: > I clearly spoke too soon. > > With the actual data I am not getting sensible x-axis > units. The program with the actual data below. Graph > output is here: > http://ca.geocities.com/jrkrideau/R/hd.png . > > I seem to be getting only a single entry for the > x-axis of "20

Re: [R] time plotting problem

2007-11-13 Thread hadley wickham
Here's a version using reshape and ggplot: mydata <- read.table("http://ca.geocities.com/jrkrideau/R/heartdata.txt";, sep="\t", header=FALSE) mydata[,1] <- as.Date(mydata[,1],"%m/%d/%y") names(mydata) <- c("dates", "sy","dys","pulse", "weight") molten <- melt(mydata, m = c("sy", "dys")) qplot(da

Re: [R] time plotting problem

2007-11-13 Thread Gabor Grothendieck
You can get a slightly better X axis by converting your Date variable to chron: Replace this: plot(mydata[,1], ...) with this: library(chron) plot(chron(unclass(mydata[,1])), ...) and ignore the warning. On Nov 13, 2007 9:08 AM, John Kane <[EMAIL PROTECTED]> wrote: > I clearly spok

Re: [R] time plotting problem

2007-11-13 Thread jim holtman
I have had some problems with dates on axis in certain ranges. Here is a version of axis.POSIXct that I have been using that seems to do a better job: my.axis.POSIXct <- function (side, x, format, inc) { .diff <- diff(range(unclass(x), na.rm = TRUE)) if (.diff < 30) { .by <- "sec

Re: [R] time plotting problem

2007-11-13 Thread John Kane
I clearly spoke too soon. With the actual data I am not getting sensible x-axis units. The program with the actual data below. Graph output is here: http://ca.geocities.com/jrkrideau/R/hd.png . I seem to be getting only a single entry for the x-axis of "2007". However dates range from Firs

Re: [R] time plotting problem

2007-11-12 Thread John Kane
Thanks to Gabor and Jim. I am not sure if the first entry year = 2009 is all the problem I'm getting but it is certainly seems like the worst of it. My stupidity: Someone sent me the data set in Excel and I didn't do the basic data checks on. I _KNEW_ the data went from 2006 to 2007. --- Gab

Re: [R] time plotting problem

2007-11-12 Thread Gabor Grothendieck
In your examples the first line of your data refers to the year 2009 and Oct 1st is repeated. Is that really what you meant? I can't tell what your problem is from your description other than the data problems cited but there are lots of examples of plotting with zoo in the following which may he

Re: [R] time plotting problem

2007-11-12 Thread jim holtman
Now your first data point is 9/26/09; is it supposed to be 9/26/06? On Nov 12, 2007 1:47 PM, John Kane <[EMAIL PROTECTED]> wrote: > I am completely misunderstanding how to handle dates. > I want to plot a couple of data series against some > dates. Simple example 1 below works fine. > Unfortunate

Re: [R] time plotting problem

2007-11-12 Thread jim holtman
So what is wrong with the plots? I used your example, and it appears to plot the data correctly. What were you expecting? On Nov 12, 2007 1:47 PM, John Kane <[EMAIL PROTECTED]> wrote: > I am completely misunderstanding how to handle dates. > I want to plot a couple of data series against some >

[R] time plotting problem

2007-11-12 Thread John Kane
I am completely misunderstanding how to handle dates. I want to plot a couple of data series against some dates. Simple example 1 below works fine. Unfortunately I have multiple observations per day (no time breakdowns) and observations across years. (example 2 very simplistic version ) Can any