Dear useRs,

I'm trying to plot spray quantities against dates, and label the points 
on the plot. Basically quite simple, but sometimes two chemicals have 
been used and are listed in separate rows in the table as below; then 
the labels are written on top of each other.

> spray
   SprayDate          PD            Trt Qwater  Qai
1 2005-03-09 Spidermites        Pegasus   1300 1.04
2 2005-03-10     Powdery            MKP    800 0.40
3 2005-03-10     Powdery  Nimrod 250 EC    800 2.40
4 2005-03-12 Spidermites        Pegasus   1300 1.04
5 2005-03-16 Spidermites        Pegasus   1300 1.04
6 2005-03-17     Powdery   Stroby 50 WG    800 0.40
7 2005-03-21 Spidermites Dynamec 1.8 EC   1250 0.62
8 2005-03-21 Spidermites   Apollo 50 SC   1250 0.62
9 2005-03-30  Whiteflies        Pegasus   1000 0.60

I came up with the work around below which gave me my plot for some of 
the data (despite warnings). The idea was to split the second chemical for each date into 
a separate file and plot the text a little higher:

> spray1 <- spray[spray$PD=="Spidermites", ]
> spray2 <- spray1[spray1$SprayDate==unique(spray1$SprayDate), ]
Warning message: 
longer object length
        is not a multiple of shorter object length in: spray1$SprayDate == unique(spray1$SprayDate) 
> spray3 <- spray1[spray1$SprayDate!=unique(spray1$SprayDate), ]
Warning message: 
longer object length
        is not a multiple of shorter object length in: spray1$SprayDate != unique(spray1$SprayDate) 
> plot(as.Date(spray2$SprayDate), spray2$Qwater, 
+     xlim = c(as.Date("2005-03-08"), as.Date("2005-03-24")), ylim = c(0,1500))
NULL
> text(as.Date(spray2$SprayDate), spray2$Qwater, 
+     labels = spray2$Trt, pos = 4, srt = 45)
NULL
> text(as.Date(spray3$SprayDate), spray3$Qwater+100, 
+     labels = spray3$Trt, pos = 4, srt = 45)
NULL

But it didn't work for everything:

> spray1 <- spray[spray$PD=="Powdery", ]
> spray2 <- spray1[spray1$SprayDate==unique(spray1$SprayDate), ]
Warning message: 
longer object length
        is not a multiple of shorter object length in: spray1$SprayDate == unique(spray1$SprayDate) 
> spray2
   SprayDate      PD Trt Qwater Qai
2 2005-03-10 Powdery MKP    800 0.4
> spray3 <- spray1[spray1$SprayDate!=unique(spray1$SprayDate), ]
Warning message: 
longer object length
        is not a multiple of shorter object length in: spray1$SprayDate != unique(spray1$SprayDate) 
> spray3
   SprayDate      PD           Trt Qwater Qai
3 2005-03-10 Powdery Nimrod 250 EC    800 2.4
6 2005-03-17 Powdery  Stroby 50 WG    800 0.4

Does anyone have a better way of splitting the second reading for each 
date off, or another way of printing two labels for one plotted point?

Any help would be greatly appreciated.

cheers,
Lisbeth


	[[alternative HTML version deleted]]


