Re: [R] Advice on plotting a factor and displaying missing levels

2008-01-19 Thread jim holtman
If you put NA instead of 0, then the line will 'break' when there is no data. I don't know if this is better than going down to zero in the case of missing data; you will have to decide. If you already have NAs, then you can replace these with zeros. On Jan 19, 2008 10:25 PM, obradoa <[EMAIL PRO

Re: [R] Advice on plotting a factor and displaying missing levels

2008-01-19 Thread Gabor Grothendieck
Use the zoo package to create a zoo object z which represents a time series with the tabulated days as values at the corresponding Date values. Merge that with a zero width series containing all the dates from the start to the end using a fill of 0. Now plot that using plot.zoo . f <- factor(c("

Re: [R] Advice on plotting a factor and displaying missing levels

2008-01-19 Thread obradoa
Great, this would work. Is it also possible to plot zero values for each missing day, so when I do the line graph it properly drops to 0 if there was no data for that day? Currently the line graph connects dots that represent days with data present, but the line graph never drops to 0. I'd appreci

Re: [R] Advice on plotting a factor and displaying missing levels

2008-01-19 Thread Gabor Grothendieck
Tabulate using table(), convert the dates to Date class and plot: f <- factor(c("10/17/07", "10/17/07", "10/17/07", "10/17/07", "10/17/07", "10/17/07", "01/09/08", "01/17/08", "01/17/08", "01/17/08")) ndays <- table(f) plot(as.Date(names(ndays), "%m/%d/%y"), ndays) On Jan 19, 2008 5:36 PM, obrad

[R] Advice on plotting a factor and displaying missing levels

2008-01-19 Thread obradoa
I am trying to plot how many records are inserted into a database on a certain date, but also represent days where no records are inserted. I can get a list of dates for inserted records using RMySQL result <- dbSendQuery(con, "select date_format(creation_ts, "%m/%d/%y") from mytable;") inserts<