All, I'd like to plot the main relationship of a grouped data object for all levels of a factor in a single panel. The sample code below creates a separate panel for each level of the factor. I realize that this could be done in other ways, but I'd like to do it via plotting the grouped data object. thanks! dave z = rnorm(18, mean=0, sd=1) x = rep(1:6, 3) y = factor(rep(c("I", "C", "P"), each = 6)) dat = data.frame(x, y, z) data.grp = groupedData(z ~ x | y, data = dat) plot(data.grp, outer = ~ y) ### this produces 1 line each in 3 panels ### how to collapse all 3 lines into 1 panel?
I don't get your meaning in what is in datagrp, anyway, try: X11() par(new=T) before calling: plot(data.grp, outer = ~ y) Xiaohui Chen Dept. of Statistics UBC, Canada>From: "Afshartous, David" <afshart at exchange.sba.miami.edu> >To: <r-help at stat.math.ethz.ch> >Subject: [R] plotting grouped data object >Date: Sat, 23 Sep 2006 18:09:38 -0400 > > >All, >I'd like to plot the main relationship of a grouped data >object for all levels of a factor in a single panel. >The sample code below creates a separate panel for each level >of the factor. I realize that this could be done in other ways, >but I'd like to do it via plotting the grouped data object. >thanks! >dave > >z = rnorm(18, mean=0, sd=1) >x = rep(1:6, 3) >y = factor(rep(c("I", "C", "P"), each = 6)) >dat = data.frame(x, y, z) >data.grp = groupedData(z ~ x | y, data = dat) >plot(data.grp, outer = ~ y) >### this produces 1 line each in 3 panels >### how to collapse all 3 lines into 1 panel? > >______________________________________________ >R-help at stat.math.ethz.ch 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.
Hello Xiaohui, data.grp is just a pseudo example of a grouped data object that is grouped according the factor y. I just tried your suggestion, but the result is that three separate panels are still created, whereas I would like to have all 3 lines in a single panel. cheers, dave -----Original Message----- From: X.H Chen [mailto:xchen_stat at hotmail.com] Sent: Saturday, September 23, 2006 6:25 PM To: Afshartous, David; r-help at stat.math.ethz.ch Subject: RE: [R] plotting grouped data object I don't get your meaning in what is in datagrp, anyway, try: X11() par(new=T) before calling: plot(data.grp, outer = ~ y) Xiaohui Chen Dept. of Statistics UBC, Canada>From: "Afshartous, David" <afshart at exchange.sba.miami.edu> >To: <r-help at stat.math.ethz.ch> >Subject: [R] plotting grouped data object >Date: Sat, 23 Sep 2006 18:09:38 -0400 > > >All, >I'd like to plot the main relationship of a grouped data object for all>levels of a factor in a single panel. >The sample code below creates a separate panel for each level of the >factor. I realize that this could be done in other ways, but I'd like >to do it via plotting the grouped data object. >thanks! >dave > >z = rnorm(18, mean=0, sd=1) >x = rep(1:6, 3) >y = factor(rep(c("I", "C", "P"), each = 6)) dat = data.frame(x, y, z) >data.grp = groupedData(z ~ x | y, data = dat) plot(data.grp, outer = ~ >y) ### this produces 1 line each in 3 panels ### how to collapse all 3 >lines into 1 panel? > >______________________________________________ >R-help at stat.math.ethz.ch 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._________________________________________________________________ Don't waste time standing in line-try shopping online. Visit Sympatico / MSN Shopping today! http://shopping.sympatico.msn.ca
On 9/23/06, Afshartous, David <afshart at exchange.sba.miami.edu> wrote:> > All, > I'd like to plot the main relationship of a grouped data > object for all levels of a factor in a single panel. > The sample code below creates a separate panel for each level > of the factor. I realize that this could be done in other ways, > but I'd like to do it via plotting the grouped data object. > thanks! > dave > > z = rnorm(18, mean=0, sd=1) > x = rep(1:6, 3) > y = factor(rep(c("I", "C", "P"), each = 6)) > dat = data.frame(x, y, z) > data.grp = groupedData(z ~ x | y, data = dat) > plot(data.grp, outer = ~ y) > ### this produces 1 line each in 3 panels > ### how to collapse all 3 lines into 1 panel?The closest I can get is dat$one <- gl(1, 18) data.grp = groupedData(z ~ x | one, data = dat) plot(data.grp, innerGroups = ~y, strip = FALSE) -Deepayan
thanks! -----Original Message----- From: Deepayan Sarkar [mailto:deepayan.sarkar at gmail.com] Sent: Monday, September 25, 2006 1:34 PM To: Afshartous, David Cc: r-help at stat.math.ethz.ch Subject: Re: [R] plotting grouped data object On 9/23/06, Afshartous, David <afshart at exchange.sba.miami.edu> wrote:> > All, > I'd like to plot the main relationship of a grouped data object for > all levels of a factor in a single panel. > The sample code below creates a separate panel for each level of the > factor. I realize that this could be done in other ways, but I'd like> to do it via plotting the grouped data object. > thanks! > dave > > z = rnorm(18, mean=0, sd=1) > x = rep(1:6, 3) > y = factor(rep(c("I", "C", "P"), each = 6)) dat = data.frame(x, y, z) > data.grp = groupedData(z ~ x | y, data = dat) plot(data.grp, outer = ~> y) ### this produces 1 line each in 3 panels ### how to collapse all 3> lines into 1 panel?The closest I can get is dat$one <- gl(1, 18) data.grp = groupedData(z ~ x | one, data = dat) plot(data.grp, innerGroups = ~y, strip = FALSE) -Deepayan