Hello, I have a dataframe as follows ``` x = c(rep("1000 pmol", 2), rep("100 pmol", 2), rep("10 pmol", 2), rep("0 pmol", 2)) y = c(2.7642, 2.8192, 2.1976, 2.2816, 1.8929, 1.8883, 1.0051, 0.8561) z = c(rep("Sample",6), rep("Control", 2)) Q = data.frame(x, y, z, stringsAsFactors = FALSE) ``` I am trying to use plotrix to draw y broke down by x and differentiate the markers by z, but I get: ```> brkdn.plot(+ y, groups=x, obs=z, + data=Q, mct="mean", md="std.error", + stagger=NA, dispbar=TRUE, + type="p", pch=16, + main="Measurement", + xlab=expression(bold("Amount of probe")), + ylab=expression(bold("Optical density")) + ) Error in .subset2(x, i, exact = exact) : no such index at level 1 ``` and similar with other combinations (`obs = x`...). What is the correct syntax? Thank you -- Best regards, Luigi
Hi Luigi, Try this: brkdn.plot(y~x+z,data=Q) Jim On Thu, Aug 27, 2020 at 9:57 PM Luigi Marongiu <marongiu.luigi at gmail.com> wrote:> > Hello, > I have a dataframe as follows > ``` > x = c(rep("1000 pmol", 2), rep("100 pmol", 2), rep("10 pmol", 2), > rep("0 pmol", 2)) > y = c(2.7642, 2.8192, 2.1976, 2.2816, 1.8929, 1.8883, 1.0051, 0.8561) > z = c(rep("Sample",6), rep("Control", 2)) > Q = data.frame(x, y, z, stringsAsFactors = FALSE) > ``` > I am trying to use plotrix to draw y broke down by x and differentiate > the markers by z, but I get: > ``` > > brkdn.plot( > + y, groups=x, obs=z, > + data=Q, mct="mean", md="std.error", > + stagger=NA, dispbar=TRUE, > + type="p", pch=16, > + main="Measurement", > + xlab=expression(bold("Amount of probe")), > + ylab=expression(bold("Optical density")) > + ) > Error in .subset2(x, i, exact = exact) : no such index at level 1 > > ``` > and similar with other combinations (`obs = x`...). > What is the correct syntax? > Thank you > > > -- > Best regards, > Luigi > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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.
exactly what I needed! Thank you so much Luigi On Thu, Aug 27, 2020 at 2:43 PM Jim Lemon <drjimlemon at gmail.com> wrote:> > Hi Luigi, > Try this: > > brkdn.plot(y~x+z,data=Q) > > Jim > > On Thu, Aug 27, 2020 at 9:57 PM Luigi Marongiu <marongiu.luigi at gmail.com> wrote: > > > > Hello, > > I have a dataframe as follows > > ``` > > x = c(rep("1000 pmol", 2), rep("100 pmol", 2), rep("10 pmol", 2), > > rep("0 pmol", 2)) > > y = c(2.7642, 2.8192, 2.1976, 2.2816, 1.8929, 1.8883, 1.0051, 0.8561) > > z = c(rep("Sample",6), rep("Control", 2)) > > Q = data.frame(x, y, z, stringsAsFactors = FALSE) > > ``` > > I am trying to use plotrix to draw y broke down by x and differentiate > > the markers by z, but I get: > > ``` > > > brkdn.plot( > > + y, groups=x, obs=z, > > + data=Q, mct="mean", md="std.error", > > + stagger=NA, dispbar=TRUE, > > + type="p", pch=16, > > + main="Measurement", > > + xlab=expression(bold("Amount of probe")), > > + ylab=expression(bold("Optical density")) > > + ) > > Error in .subset2(x, i, exact = exact) : no such index at level 1 > > > > ``` > > and similar with other combinations (`obs = x`...). > > What is the correct syntax? > > Thank you > > > > > > -- > > Best regards, > > Luigi > > > > ______________________________________________ > > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > > 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.-- Best regards, Luigi