[R] Requesting help with lattice again
Sundar Dorai-Raj
sdorairaj at gmail.com
Wed Mar 25 17:27:02 CET 2009
For the first question, add a groups argument. E.g.
barchart(HSI ~ Scenario | Region, Wbirdsm, groups = HydroState)
Also note that using Wbirdsm$HSI makes your call less readable, so I
added the data argument.
For your second question, setting the key does not set the color
theme. You want to set the colors using par.setting. E.g.
dotplot(HSI ~ Scenario | Region, Wbirdsm,
groups = HydroState,
par.settings = list(superpose.symbol =
list(col = c("red", "green", "blue"))),
auto.key = list(space = "right"))
Then use auto.key instead of key.
HTH,
--sundar
On Wed, Mar 25, 2009 at 7:02 AM, <Steve_Friedman at nps.gov> wrote:
>
> Hello, this is a request for assistance that I submitted earlier, this time
> with the dataset. My mistake for taking up bandwidth. I've also rephrased
> the question to address an additional concern.
>
> I'm working on a windows XP machine with R 2.8.1
>
> 1). I'd like a barchart (or other lattice type display) HSI ~ of the three
> factors (Region, Scenario and HydroState).
> However barchart complains
>
>> library(reshape)
>> library(lattice)
>
>> barchart(Wbirdsm$HSI ~ WBirdsm$Scenario | WBridsm$Region)
>
>> # This works, but only marginally. I'd like specify the interaction
> between the variables ( Scenario and HydroState)
>> What is the best way to combine these factors so they can be treated
> as a single variable and rewrite the barchart call?
>
>> barchart(Wbirdsm$HSI ~ WBirdsm$"interaction between Scenario and
> HydroState") ~ Wbirdsm$Region)
>
>
>
> The second question refers back to my original posting.
> 2) # using dotplot instead of barchart I use the following code.
>
>> key.variable <- list(space = "right", text =
> list(levels(wbirdm$variable)), points = list(pch = 1:3,
> col=c("red","green", "blue")))
>> dotplot(wbirdm$value ~ wbirdm$variable | wbirdm$Region, col=c(1:9), pch=
> rep(c(1:3), key = key.variable, groups=wbirdm$variable, ylab= "Mean
> HSI"))
>
>> # However the key legend doesn't appear in the plot with this sequence
> and the labels are too along the panels. Is there a way to address this?
>
>
> thank you very much for the assistance.
>
> Steve
>
>
> This is part of the larger data base, after I passed it thru melt.
>
>
>
> Region Species Scenario HydroState
> HSI
> 1 Eastern Panhandle WBLong NSM Ave
> 0.165945170
> 2 Eastern Panhandle WBLong NSM Dry
> 0.056244263
> 3 Eastern Panhandle WBLong NSM Wet
> 0.290692607
> 4 Eastern Panhandle WBLong ECB Ave
> 0.165945170
> 5 Eastern Panhandle WBLong ECB Dry
> 0.056244263
> 6 Eastern Panhandle WBLong ECB Wet
> 0.290692607
> 7 Eastern Panhandle WBLong CERP Ave
> 0.165945170
> 8 Eastern Panhandle WBLong CERP Dry
> 0.056244263
> 9 Eastern Panhandle WBLong CERP Wet
> 0.290692607
> 10 Long Pine Key / South Taylor Slough WBLong NSM Ave
> 0.151159734
> 11 Long Pine Key / South Taylor Slough WBLong NSM Dry
> 0.067348863
> 12 Long Pine Key / South Taylor Slough WBLong NSM Wet
> 0.244440738
> 13 Long Pine Key / South Taylor Slough WBLong ECB Ave
> 0.151159734
> 14 Long Pine Key / South Taylor Slough WBLong ECB Dry
> 0.067348863
> 15 Long Pine Key / South Taylor Slough WBLong ECB Wet
> 0.244440738
> 16 Long Pine Key / South Taylor Slough WBLong CERP Ave
> 0.151159734
> 17 Long Pine Key / South Taylor Slough WBLong CERP Dry
> 0.067348863
> 18 Long Pine Key / South Taylor Slough WBLong CERP Wet
> 0.244440738
> 19 Northern Taylor Slough WBLong NSM Ave
> 0.115503291
> 20 Northern Taylor Slough WBLong NSM Dry
> 0.005617136
> 21 Northern Taylor Slough WBLong NSM Wet
> 0.252428530
> 22 Northern Taylor Slough WBLong ECB Ave
> 0.115503291
> 23 Northern Taylor Slough WBLong ECB Dry
> 0.005617136
> 24 Northern Taylor Slough WBLong ECB Wet
> 0.252428530
> 25 Northern Taylor Slough WBLong CERP Ave
> 0.115503291
> 26 Northern Taylor Slough WBLong CERP Dry
> 0.005617136
> 27 Northern Taylor Slough WBLong CERP Wet
> 0.252428530
> 28 East Slough WBLong NSM Ave
> 0.313215457
> 29 East Slough WBLong NSM Dry
> 0.046917053
> 30 East Slough WBLong NSM Wet
> 0.447002596
> 31 East Slough WBLong ECB Ave
> 0.313215457
> 32 East Slough WBLong ECB Dry
> 0.046917053
> 33 East Slough WBLong ECB Wet
> 0.447002596
> 34 East Slough WBLong CERP Ave
> 0.313215457
> 35 East Slough WBLong CERP Dry
> 0.046917053
> 36 East Slough WBLong CERP Wet
> 0.046917053
> 37 Shark Slough WBLong NSM Ave
> 0.479722873
> 38 Shark Slough WBLong NSM Dry
> 0.232024256
> 39 Shark Slough WBLong NSM Wet
> 0.449336931
> 40 Shark Slough WBLong ECB Ave
> 0.479722873
> 41 Shark Slough WBLong ECB Dry
> 0.232024256
> 42 Shark Slough WBLong ECB Wet
> 0.449336931
> 43 Shark Slough WBLong CERP Ave
> 0.479722873
> 44 Shark Slough WBLong CERP Dry
> 0.232024256
> 45 Shark Slough WBLong CERP Wet
> 0.449336931
> 46 Northeast Shark Slough WBLong NSM Ave
> 0.326464412
> 47 Northeast Shark Slough WBLong NSM Dry
> 0.233158644
> 48 Northeast Shark Slough WBLong NSM Wet
> 0.199261704
> 49 Northeast Shark Slough WBLong ECB Ave
> 0.326464412
> 50 Northeast Shark Slough WBLong ECB Dry
> 0.233158644
>
>
>
>
> Steve Friedman Ph. D.
> Spatial Statistical Analyst
> Everglades and Dry Tortugas National Park
> 950 N Krome Ave (3rd Floor)
> Homestead, Florida 33034
>
> Steve_Friedman at nps.gov
> Office (305) 224 - 4282
> Fax (305) 224 - 4147
>
> ______________________________________________
> R-help at 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.
>
More information about the R-help
mailing list