[R] ggplot question error: Error in s(x, bs = "cs") : object 'x' not found
jrkrideau at inbox.com
Fri Nov 21 18:01:08 CET 2014
I am not sure I completely understand the issue but here is what I think you want (using my variable names :) )
dat1 <- data.frame(aa = sample(1:20, 100, replace = TRUE), bb = 1:100 )
p <- ggplot(dat1, aes(aa, bb)) + geom_point()
p <- p + geom_smooth(se = FALSE)
Kingston ON Canada
> -----Original Message-----
> From: dimitri.liakhovitski at gmail.com
> Sent: Thu, 20 Nov 2014 17:14:27 -0500
> To: r-help at r-project.org
> Subject: [R] ggplot question error: Error in s(x, bs = "cs") : object 'x'
> not found
> Dear R-ers,
> apologies for not providing the full code. I just need a point in the
> right direction.
> I have a data frame ('temp') with 1,200 rows and 2 variables.
> I am using ggplot2 to create a scatter plot:
> This is my code and it works fine, it creates a scatter plot:
> sp10 + geom_point()
> However, when I change the last line to:
> sp10 + geom_point() + stat_smooth(se=FALSE)
> Then I am getting these messages (and no fitted line on the graph):
> geom_smooth: method="auto" and size of largest group is >=1000, so
> using gam with formula: y ~ s(x, bs = "cs"). Use 'method = x' to
> change the smoothing method.
> Error in s(x, bs = "cs") : object 'x' not found
> I don't understand what x in in s(x, bs = "cs") is or should be.
> I lookeed up ?geom_smooth and tried this:
> sp10 + geom_point() + stat_smooth(se=FALSE,formula = l.to.r.ratio_L1 ~
> Still, the same error message.
> Thanks a lot for your advice!
> R-help at r-project.org mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.
More information about the R-help