[R] AES spesification

Engin Yılmaz |@p@nyo|com @end|ng |rom gm@||@com
Wed Oct 21 15:37:23 CEST 2020


Dear

I use dataset , as called "mpg"

This is code

ggplot(data=mpg)+ geom_point(mapping = aes(x=displ, y=hwy, colour=year))

But I would like to see only "year of 1999" in this relationship between x
and y variables

How could I change the code in this direction?

I found the following code

library(dplyr)year_1999 <- filter(mpg, year=="1999")ggplot(year_1999,
aes(x=displ, y=hwy)) + geom_point()


I found other code

ggplot(data = mpg, mapping = aes(x = displ, y = hwy)) +

    geom_point(

      data = filter(mpg, year == "1999")

    )


Is there more compact code ?


sincerely
Engin YILMAZ

	[[alternative HTML version deleted]]



More information about the R-help mailing list