To load the dplyr and palmerpenguis packages in R, first, we need to install them. If you haven't installed them yet, use the following code to do so:
main.r61 chars3 lines
Once you have installed the packages, you can load them using the following code:
main.r39 chars3 lines
To create the ggplot with body mass and flipper length, use the following code:
main.r97 chars3 lines
In this code, we are creating a scatter plot using ggplot function. The variables body_mass_g
and flipper_length_mm
are assigned to the x
and y
aesthetics, respectively. We use species
to define color using the color
parameter in the aes()
function. Finally, we add a layer of geom_point()
to make it into a scatter plot.
gistlibby LogSnag