Discussion:
Computation failed in `stat_smooth()`: object not found
Moritz Camenzind
2018-06-19 10:45:10 UTC
Permalink
Dear All,

I am trying to plot a logarithmic model to my data as follows:

ggplot(sub_tillers, aes(x = gdd, y = tillers))+
geom_line()+
geom_smooth(method = "lm", formula = tillers ~ log(ggd))

However, I get the following message (in German):

Computation failed in `stat_smooth()`:
Objekt 'tillers' nicht gefunden

The same code works perfectly, if I do not add the formula argument.

Added is my dataset and here my session info:

R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 17.10

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.2.20.so

locale:
[1] LC_CTYPE=de_DE.UTF-8 LC_NUMERIC=C
LC_TIME=de_DE.UTF-8 LC_COLLATE=de_DE.UTF-8
[5] LC_MONETARY=de_DE.UTF-8 LC_MESSAGES=de_DE.UTF-8
LC_PAPER=de_DE.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] grid stats graphics grDevices utils datasets methods
base

other attached packages:
[1] plyr_1.8.4 ggsnippets_1.0 digest_0.6.15 gridExtra_2.3
gtable_0.2.0 dplyr_0.7.4 tidyr_0.8.0 ggplot2_2.2.1

loaded via a namespace (and not attached):
[1] Rcpp_0.12.16 bindr_0.1.1 magrittr_1.5 munsell_0.4.3
colorspace_1.3-2 R6_2.2.2 rlang_0.2.0
[8] tools_3.4.4 yaml_2.1.18 lazyeval_0.2.1 assertthat_0.2.0
tibble_1.4.2 bindrcpp_0.2.2 purrr_0.2.4
[15] glue_1.2.0 labeling_0.3 compiler_3.4.4 pillar_1.2.1
scales_0.5.0 pkgconfig_2.0.1


I hope this info is sufficient and thanks a lot in advance,

Moritz Camenzind
--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility

To post: email ***@googlegroups.com
To unsubscribe: email ggplot2+***@googlegroups.com
More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Roman Luštrik
2018-06-19 12:24:04 UTC
Permalink
You need to refer to the variables as you map them in aes. `tillers` should
become `y` and `gdd` `x`.

See?
ggplot(iris, aes(x = Sepal.Length, y = Petal.Length)) +
+ geom_point() +
+ geom_smooth(method = "lm", formula = Petal.Length ~ Sepal.Length)
Warning message:
Computation failed in `stat_smooth()`:
object 'Petal.Length' not found
ggplot(iris, aes(x = Sepal.Length, y = Petal.Length)) +
+ geom_point() +
+ geom_smooth(method = "lm", formula = y ~ log(x))
Cheers,
Roman
Dear All,
ggplot(sub_tillers, aes(x = gdd, y = tillers))+
geom_line()+
geom_smooth(method = "lm", formula = tillers ~ log(ggd))
Objekt 'tillers' nicht gefunden
The same code works perfectly, if I do not add the formula argument.
R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 17.10
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.2.20.so
[1] LC_CTYPE=de_DE.UTF-8 LC_NUMERIC=C
LC_TIME=de_DE.UTF-8 LC_COLLATE=de_DE.UTF-8
[5] LC_MONETARY=de_DE.UTF-8 LC_MESSAGES=de_DE.UTF-8
LC_PAPER=de_DE.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C
[1] grid stats graphics grDevices utils datasets methods
base
[1] plyr_1.8.4 ggsnippets_1.0 digest_0.6.15 gridExtra_2.3
gtable_0.2.0 dplyr_0.7.4 tidyr_0.8.0 ggplot2_2.2.1
[1] Rcpp_0.12.16 bindr_0.1.1 magrittr_1.5 munsell_0.4.3
colorspace_1.3-2 R6_2.2.2 rlang_0.2.0
[8] tools_3.4.4 yaml_2.1.18 lazyeval_0.2.1 assertthat_0.2.0
tibble_1.4.2 bindrcpp_0.2.2 purrr_0.2.4
[15] glue_1.2.0 labeling_0.3 compiler_3.4.4 pillar_1.2.1
scales_0.5.0 pkgconfig_2.0.1
I hope this info is sufficient and thanks a lot in advance,
Moritz Camenzind
--
--
You received this message because you are subscribed to the ggplot2 mailing list.
https://github.com/hadley/devtools/wiki/Reproducibility
More options: http://groups.google.com/group/ggplot2
---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
In God we trust, all others bring data.
--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility

To post: email ***@googlegroups.com
To unsubscribe: email ggplot2+***@googlegroups.com
More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Moritz Camenzind
2018-06-19 12:42:11 UTC
Permalink
Hi Roman

It works perfectly now.

Thanks a lot for your quick answer, it's much appreciated!

Have a nice day,
Moritz
Post by Roman Luštrik
You need to refer to the variables as you map them in aes. `tillers`
should become `y` and `gdd` `x`.
See?
ggplot(iris, aes(x = Sepal.Length, y = Petal.Length)) +
+ geom_point() +
+ geom_smooth(method = "lm", formula = Petal.Length ~ Sepal.Length)
object 'Petal.Length' not found
ggplot(iris, aes(x = Sepal.Length, y = Petal.Length)) +
+ geom_point() +
+ geom_smooth(method = "lm", formula = y ~ log(x))
Cheers,
Roman
Dear All,
ggplot(sub_tillers, aes(x = gdd, y = tillers))+
geom_line()+
geom_smooth(method = "lm", formula = tillers ~ log(ggd))
Objekt 'tillers' nicht gefunden
The same code works perfectly, if I do not add the formula argument.
R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 17.10
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.2.20.so
[1] LC_CTYPE=de_DE.UTF-8 LC_NUMERIC=C
LC_TIME=de_DE.UTF-8 LC_COLLATE=de_DE.UTF-8
[5] LC_MONETARY=de_DE.UTF-8 LC_MESSAGES=de_DE.UTF-8
LC_PAPER=de_DE.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C
[1] grid stats graphics grDevices utils datasets methods
base
[1] plyr_1.8.4 ggsnippets_1.0 digest_0.6.15 gridExtra_2.3
gtable_0.2.0 dplyr_0.7.4 tidyr_0.8.0 ggplot2_2.2.1
[1] Rcpp_0.12.16 bindr_0.1.1 magrittr_1.5 munsell_0.4.3
colorspace_1.3-2 R6_2.2.2 rlang_0.2.0
[8] tools_3.4.4 yaml_2.1.18 lazyeval_0.2.1 assertthat_0.2.0
tibble_1.4.2 bindrcpp_0.2.2 purrr_0.2.4
[15] glue_1.2.0 labeling_0.3 compiler_3.4.4 pillar_1.2.1
scales_0.5.0 pkgconfig_2.0.1
I hope this info is sufficient and thanks a lot in advance,
Moritz Camenzind
--
--
You received this message because you are subscribed to the ggplot2 mailing list.
https://github.com/hadley/devtools/wiki/Reproducibility
More options: http://groups.google.com/group/ggplot2
---
You received this message because you are subscribed to the Google Groups
"ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
In God we trust, all others bring data.
--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility

To post: email ***@googlegroups.com
To unsubscribe: email ggplot2+***@googlegroups.com
More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...