Christopher David Desjardins
2009-Mar-12 22:37 UTC
[R] Unable to run smoother in qplot() or ggplot() - complains about knots
I get the following error when I run qplot()
qplot(grade, read,data = hhm.long.m, geom = c("point",
"smooth"))
Error in smooth.construct.cr.smooth.spec(object, data, knots) :
x has insufficient unique values to support 10 knots: reduce k.
I am not sure how to tackle this problem. When I take a subsample (<
1000) than I am able to run that function but with my sample of ~
40,000 qplot gives me that error. I have 6 grades.
Please cc me on reply.
Thanks!
Chris
Ista Zahn
2009-Mar-13 12:57 UTC
[R] Unable to run smoother in qplot() or ggplot() - complains about knots
> From: Christopher David Desjardins <cddesjardins at gmail.com> > To: r-help at r-project.org > Date: Thu, 12 Mar 2009 17:37:26 -0500 > Subject: [R] Unable to run smoother in qplot() or ggplot() - complains about knots > I get the following error when I run qplot() > > qplot(grade, read,data = hhm.long.m, geom = c("point", "smooth")) > > Error in smooth.construct.cr.smooth.spec(object, data, knots) : > x has insufficient unique values to support 10 knots: reduce k. > > I am not sure how to tackle this problem. When I take a subsample (< 1000) than I am able to run that function but with my sample of ~ ?40,000 qplot gives me that error. I have 6 grades. > Please cc me on reply.Hi Chris, Have you read the documentation for stat_smooth? It's not clear to me what the problem is, because I'm not sure what the defaults are. But since the default's are not working, I would try it with different settings. See http://had.co.nz/ggplot2/stat_smooth.html. -Ista> > > Thanks! > Chris
hadley wickham
2009-Mar-13 13:31 UTC
[R] Unable to run smoother in qplot() or ggplot() - complains about knots
On Thu, Mar 12, 2009 at 5:37 PM, Christopher David Desjardins <cddesjardins at gmail.com> wrote:> I get the following error when I run qplot() > > qplot(grade, read,data = hhm.long.m, geom = c("point", "smooth")) > > Error in smooth.construct.cr.smooth.spec(object, data, knots) : > ?x has insufficient unique values to support 10 knots: reduce k. > > I am not sure how to tackle this problem. When I take a subsample (< 1000) > than I am able to run that function but with my sample of ~ ?40,000 qplot > gives me that error. I have 6 grades.You have 6 values on the x-axis? Maybe you want to just calculate the mean at each grade. If so, see http://had.co.nz/ggplot2/stat_summary.html Hadley -- http://had.co.nz/
jtizzle36
2012-May-31 10:23 UTC
[R] Unable to run smoother in qplot() or ggplot() - complains about knots
I am guessing his data is at fixed time points or something similar. As a "cheat" you can apply a jitter function to the x values and it should draw... g <- ggplot(data, aes(x = jitter(x), y = y,... J -- View this message in context: http://r.789695.n4.nabble.com/Unable-to-run-smoother-in-qplot-or-ggplot-complains-about-knots-tp879862p4631917.html Sent from the R help mailing list archive at Nabble.com.