[R] Requesting help with lattice again

2009-03-25 Thread Steve_Friedman

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
1Eastern Panhandle  WBLong  NSMAve
0.165945170
2Eastern Panhandle  WBLong  NSMDry
0.056244263
3Eastern Panhandle  WBLong  NSMWet
0.290692607
4Eastern Panhandle  WBLong  ECBAve
0.165945170
5Eastern Panhandle  WBLong ECB Dry
0.056244263
6Eastern Panhandle  WBLong ECB Wet
0.290692607
7Eastern Panhandle  WBLong CERPAve
0.165945170
8Eastern Panhandle  WBLong CERPDry
0.056244263
9Eastern Panhandle  WBLong CERPWet
0.290692607
10 Long Pine Key / South Taylor Slough  WBLong  NSMAve
0.151159734
11 Long Pine Key / South Taylor Slough  WBLong  NSMDry
0.067348863
12 Long Pine Key / South Taylor Slough  WBLong  NSMWet
0.20738
13 Long Pine Key / South Taylor Slough  WBLong  ECBAve
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.20738
16 Long Pine Key / South Taylor Slough  WBLong CERPAve
0.151159734
17 Long Pine Key / South Taylor Slough  WBLong CERPDry
0.067348863
18 Long Pine Key / South Taylor Slough  WBLong CERPWet
0.20738
19  Northern Taylor Slough  WBLong  NSMAve
0.115503291
20  Northern Taylor Slough  WBLong  NSMDry
0.005617136
21  Northern Taylor Slough  WBLong  NSMWet
0.252428530
22  Northern Taylor Slough  WBLong  ECBAve
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 CERPAve
0.115503291
26  Northern Taylor Slough  WBLong CERPDry
0.005617136
27  Northern Taylor Slough  WBLong CERPWet
0.252428530
28 East Slough  WBLong  NSMAve
0.313215457
29 East Slough  WBLong  NSMDry
0.046917053
30 East Slough  WBLong  NSMWet
0.447002596
31 East Slough  WBLong  ECBAve
0.313215457
32 East Slough  WBLong ECB Dry
0.046917053
33 East Slough  WBLong ECB Wet
0.447002596
34 East Slough  WBLong CERPAve
0.313215457
35 East Slough  WBLong CERPDry
0.046917053
36 East Slough  WBLong CERPWet
0.046917053
37Shark Slough  WBLong  NSMAve
0.479722873
38Shark Slough  WBLong  NSMDry
0.232024256
39Shark Slough  WBLong  NSMWet
0.449336931
40Shark Slough  WBLong  ECBAve
0.479722873
41Shark Slough  WBLong ECB Dry
0.232024256
42Shark Slough  WBLong ECB Wet
0.449336931
43Shark Slough  WBLong CERPAve
0.479722873
44  

Re: [R] Requesting help with lattice again

2009-03-25 Thread Sundar Dorai-Raj
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_fried...@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.20738
 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.20738
 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.20738
 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