install.packages("ggplot2")
library(ggplot2)
library(tidyverse)
mpg
view(mpg)
glimpse(mpg)
#>Ex. 3: In the scatterplot of hwy versus displ, what happens if you map a third variable to linewidth?
ggplot(mpg, aes(x = hwy, y = displ)) +
geom_density(linewidth = 0.75)
Console:
" ggplot(mpg, aes(x = hwy, y = displ)) +
- geom_density(linewidth = 0.75)
Error ingeom_density()
:
! Problem while setting up geom.
Error occurred in the 1st layer.
Caused by error incompute_geom_1()
:
!geom_density()
requires the following missing aesthetics: y
Runrlang::last_trace()
to see where the error occurred.
Warning message:
The following aesthetics were dropped during statistical transformation: y
This can happen when ggplot fails to infer the correct grouping structure in the data.
Did you forget to specify agroup
aesthetic or to convert a numerical variable into a factor? "
¿Problem, hmmm...?