On Thu, Jul 15, 2010 at 5:51 PM, Farley, Robert <farl...@metro.net> wrote: > I'm trying to plot a series of densities using/comparing differing weights. > I see the reference to weights and subscripts, but I don't understand how > to implement that. My data are of the form: > > I, J, Actual, Distance, Subset, Weight1, Weight2, ... > > I'm trying to see the effect of the distance distribution (Actual by Distance) > compared to the various weighted distributions (Subset*WeightX by Distance) > > I presume I and J are the subscripts to the weight Variable in densityplot. > If anyone has a code snippet of densityplot using weights, I could get > started.... >
I'm not sure what I and J are in your data, or what you want exactly. But here is an example using 'weights': faithful$dummy <- gl(2, 1, nrow(faithful)) p1 <- densityplot(~eruptions | dummy, faithful, main = "unweighted") p2 <- densityplot(~eruptions | dummy, faithful, weights = 1/waiting, main = "weighted") plot(p1, split = c(1, 1, 1, 2)) plot(p2, split = c(1, 2, 1, 2), newpage = FALSE) -Deepayan ______________________________________________ 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.