After unzipping that file, http://dl.dropbox.com/u/537118/gdf.zip , I got a structure object that took what seemed to be an inordinately long time to eval-parse wehn assigned to gdf, but it did eventually produce:

> str(gdf)
'data.frame':   2656 obs. of  21 variables:
$ OnDate :Class 'Date' num [1:2656] 14222 14221 14334 14424 14519 ... $ FltOrigDt : chr "12/9/2008" "12/8/2008" "3/31/2009" "6/29/2009" ...
$ MkdCrrCd      : chr  "DL" "DL" "DL" "DL" ...
$ MkdFltNbr : int 742 1517 1517 1517 1517 1699 1065 1777 1777 1777 ...
$ DprtTrpnStnCd : chr  "DEN" "JAX" "JAX" "JAX" ...
$ ArrTrpnStnCd  : chr  "ATL" "ATL" "ATL" "ATL" ...
$ ActualOutLocal: POSIXct, format: "2008-12-09 01:04:00" "2008-12-08 05:37:00" "2009-03-31 05:32:00" ... $ ActualOffLocal: POSIXct, format: "2008-12-09 01:47:00" "2008-12-08 06:11:00" "2009-03-31 05:43:00" ... $ ActualOnLocal : POSIXct, format: "2008-12-09 06:10:00" "2008-12-08 06:56:00" "2009-03-31 06:33:00" ... $ ActualInLocal : POSIXct, format: "2008-12-09 06:18:00" "2008-12-08 07:02:00" "2009-03-31 06:39:00" ... $ ArrivalGate : Factor w/ 100 levels "A01","A02","A03",..: 2 2 2 2 2 2 2 2 2 2 ...
$ DepartureGate : chr  "C44" "A7" "A7" "A10" ...
$ Flight        : chr  "DAL742" "DAL1517" "DAL1517" "DAL1517" ...
$ OnHour        : chr  "6" "6" "6" "6" ...
$ OnDateTime : POSIXct, format: "2008-12-09 06:10:00" "2008-12-08 06:56:00" "2009-03-31 06:33:00" ... $ Runway : Factor w/ 10 levels "08L","08R","09L",..: 2 4 4 7 4 7 8 8 1 7 ...
$ Delay         : int  15 8 NA NA NA NA NA NA NA NA ...
$ TaxiTime :Class 'difftime' atomic [1:2656] 480 360 360 240 360 420 300 300 540 780 ...
 .. ..- attr(*, "units")= chr "secs"
$ passurdt      : num  0 0 0 0 1 0 0 0 0 -7 ...
$ OnHFact : Ord.factor w/ 24 levels "0"<"1"<"2"<"3"<..: 7 7 7 7 7 8 8 13 13 12 ...
$ tt            : num  8 6 6 4 6 7 5 5 9 13 ...



On Apr 16, 2010, at 9:37 PM, James Rome wrote:

On 4/16/2010 8:27 PM, Jun Shen wrote:Jim,

Try this,

bwplot(tt~as.factor(OnHour),data=gdf,......)

Jun Shen from Millipore

I already tried using a factor, and the data set I enclosed had
gdf$OnHFact which was already a factor. It gave the same wrong plot.

What did work was to call xyplot instead of bwplot, and to use
panel.bwplot in the panel function:

      hrs = seq(0, 23, 1)
     hrlabs = as.character(seq(0,23,1))
      g = xyplot(gdf$tt~gdf$OnHour |gdf$Runway, data=gdf,

This is a puzzling way to invoke xyplot and may have unforeseen dangers. Generally when one uses a data argument to a plot function, one does not also include that dataframe name in the formula terms on either the LHS or the RHS.

ylab="Taxi
time (min)", main=title, xlab="Hour of day",
          xlim=c(-1, 24), scales=list(x = list(rot=90, cex=.6,
alternating=c(3,3,3,3),
          at=hrs, labels=hrlabs
          )),
          panel=function(x, ...) {
              panel.grid(h = -1, v = 24)
              panel.bwplot(x, horizontal=FALSE, col="black",...)

          }
      )
      print(g)

I took your initial code for a bwplot call and took out the extraneous dataframe name in the formula terms and put in your axis code (with more sensible formatting) and got what appears to be your desired plot:

bwplot( tt~ OnHour |Runway, data=gdf,
        scales=list(x = list(rot=90, cex=.6,
                              alternating=c(3,3,3,3),
                              at=hrs, labels=hrlabs
                    )        ),
        horizontal=FALSE)

Plot was attached in my first effort at posting but was too big for the list-server.



But I do not understand why this makes a difference. It has something to
do with the fact that there are no data for some of the hours.

I have not been able to figure out what you meant by "bars in the wrong place". You could have been more forthcoming about what you saw as the problem for the Readers of the list. My guess is that it has something to do with not following the specified conventions for arguments to the bwplot formula method.


The difference between the calls  is either a bug, or it should be in
the documentation somewhere obvious. I spent a week on this.

To report a bug you need a lot more specifics about your system and better efforts at isolation to minimal cases.


Thanks,
Jim Rome

Thanks,
Jim Rome

--

David Winsemius, MD
West Hartford, CT

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to