Data frame has this structure: 'data.frame': 11169 obs. of 4 variables: $ stream : Factor w/ 37 levels "Burns","CIL",..: 1 1 1 1 1 1 1 1 1 1 ... $ sampdate: Date, format: "1987-07-23" "1987-09-17" ... $ param : Factor w/ 8 levels "As","Ca","Cl",..: 1 1 1 1 1 1 1 1 1 1 ... $ quant : num 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0 ... I want to create scatter plots of the concentrations (numeric column 'quant') for two specified chemicals (factor column 'param') for all dates and streams (factor column 'stream') in which there are data. Looking in ?lattice and Deepayan's book did not provide an example. I've tried varies formulae but without success, and would appreciate a pointer to documentation and examples of how to write such an expression. Rich
Hi: Question: Do you want 37 different panels with plots of quant vs. date by param, or two panels (one per chemical) with all 37 streams? If you only want two of the eight chemicals, I'd suggest using subset() to select out the pair you want and then redefine the param factor so that the subset data frame has two factor levels instead of eight. Since there are several ways to interpret 'in which there are data', you might want to expound a little further about your intentions in that regard. HTH, Dennis On Thu, Sep 22, 2011 at 3:03 PM, Rich Shepard <rshepard at appl-ecosys.com> wrote:> ?Data frame has this structure: > > 'data.frame': ? 11169 obs. of ?4 variables: > ?$ stream ?: Factor w/ 37 levels "Burns","CIL",..: 1 1 1 1 1 1 1 1 1 1 ... > ?$ sampdate: Date, format: "1987-07-23" "1987-09-17" ... > ?$ param ? : Factor w/ 8 levels "As","Ca","Cl",..: 1 1 1 1 1 1 1 1 1 1 ... > ?$ quant ? : num ?0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0 ... > > ?I want to create scatter plots of the concentrations (numeric column > 'quant') for two specified chemicals (factor column 'param') for all dates > and streams (factor column 'stream') in which there are data. > > ?Looking in ?lattice and Deepayan's book did not provide an example. I've > tried varies formulae but without success, and would appreciate a pointer to > documentation and examples of how to write such an expression. > > Rich > > ______________________________________________ > 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. >
On Sep 22, 2011, at 6:03 PM, Rich Shepard wrote:> Data frame has this structure: > > 'data.frame': 11169 obs. of 4 variables: > $ stream : Factor w/ 37 levels "Burns","CIL",..: 1 1 1 1 1 1 1 1 1 > 1 ... > $ sampdate: Date, format: "1987-07-23" "1987-09-17" ... > $ param : Factor w/ 8 levels "As","Ca","Cl",..: 1 1 1 1 1 1 1 1 1 > 1 ... > $ quant : num 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0 ... > > I want to create scatter plots of the concentrations (numeric column > 'quant') for two specified chemicals (factor column 'param') for all > dates > and streams (factor column 'stream') in which there are data.Scatterplots are for two variables with continuous valued data. You are asking about one such variable, apparently within some combination of groups of discrete variables. Look at dotplot or bwplot examples.> > Looking in ?lattice and Deepayan's book did not provide an example. > I've > tried varies formulae but without success, and would appreciate a > pointer to > documentation and examples of how to write such an expression.The problem is with the choice of plotting function not fitting the problem, not with the formula. -- David Winsemius, MD West Hartford, CT
On Thu, 22 Sep 2011, David Winsemius wrote:> Scatterplots are for two variables with continuous valued data. You are > asking about one such variable, apparently within some combination of > groups of discrete variables. Look at dotplot or bwplot examples.David, Good catch. Point noted. Thanks, Rich