rggplot2

Google Data Analysis Cert - RStudio the Penguins Scatterplot is not being created?


I'm trying to recreate course material from video and instructions. The topic is R and RStudio. I believe I have executed according to instructor, but scatter plot is not being created.

Here is code:

install.packages("tidyverse")
library(tidyverse)
library(ggplot2)


data(penguins)

view(penguins)
view(penguins_raw)

ggplot(data=penguins, aes(x=flipper_length_mm, y=body_mass_g))+geom_point(aes(color=species))

I'm expecting a plot of the penguins analysis to appear, but there are no plots available, even after I've run the code.


Solution

  • Your code won't be reproducible because you forgot to load the palmerpenguins package, which is where the penguins data comes from. This stripped-down version of your code worked fine for me (I omitted the install.packages calls, because you don't need to call that every time you run the code).

    library(palmerpenguins)
    library(tidyverse)
    
    data(penguins)
    
    ggplot(data=penguins, aes(x=flipper_length_mm, y=body_mass_g)) + 
      geom_point(aes(color=species))
    

    enter image description here

    My guess is that your Plots window isn't open, as suggested by MrFlick.