0

The problem arise when I try to generate use the geom_vline and geom_hline function to have the mean lines, when I click run it appears the message: Warning messages:

1: Removed 1 rows containing missing values (geom_vline).

2: Removed 1 rows containing missing values (geom_hline).

3: Removed 1 rows containing missing values (geom_text).

I am running the following functions to create the scatter plot (I just started using ggplot2 in Rstudio, so pardon my coding mistakes, plus it is the first time posting here for help):

See the here the images of the code code and plot plot

enter image description here

enter image description here

Community
  • 1
  • 1
Pierre
  • 151
  • 1
  • 8
  • Hi @Pierre, we cannot reproduce or work with the code if you have it as an image. Can you put it as part of your post and also include the data if possible? for example, dput(head(final,10)) and paste the output – StupidWolf Apr 05 '20 at 00:07
  • Welcome to Stack Overflow! Could you make your problem reproducible by sharing a sample of your data so others can help (please do not use `str()`, `head()` or screenshot)? You can use the [`reprex`](https://reprex.tidyverse.org/articles/articles/magic-reprex.html) and [`datapasta`](https://cran.r-project.org/web/packages/datapasta/vignettes/how-to-datapasta.html) packages to assist you with that. See also [Help me Help you](https://speakerdeck.com/jennybc/reprex-help-me-help-you?slide=5) & [How to make a great R reproducible example?](https://stackoverflow.com/q/5963269) – Tung Apr 05 '20 at 03:14
  • please show some of the data, you may be having an issue with some of the line items in the dataset – wburke22 Apr 05 '20 at 03:22
  • 2
    In the image of your code you are filtering out observations with `NA` values for the columns to plot. However, you don't take acccount of `NA`s in your computation of the means. So I guess your means are simply NAs. That's what the warnings suggest. Therefore. Try `mean(XXXX, na.rm = TRUE)`. – stefan Apr 05 '20 at 10:26
  • Hello everyone, thank you for your comments and suggestions (next time I will try to correctly put the code and data in my questions). As I said before, it is my first time trying these programs and it is really encouraging to see that stack overflow is a fantastic place to go for help. I tried @stefan suggestion and it worked! Again, I will remember to put the code next time. – Pierre Apr 05 '20 at 13:23

0 Answers0