[R] How to understand the mentality behind tidyverse and ggplot2?

Bert Gunter bgunter@4567 @end|ng |rom gm@||@com
Wed Nov 18 19:28:19 CET 2020


This is not the place for tutorials (although I recognize that many
responses and discussions do intersect tutoriality).
If you do a web search on ggplot tutorials you will find many good ones. Or
go to the RStudio website which links to resources, including Hadley
Wickham's book, which is probably the most authoritative. Incidentally,
ggplot is based on Leland WIlkinson's book "The Grammar of Graphics" that
provided the blueprint for Wickham's software (his PhD project at Iowa
State I believe).

Cheers,

Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Wed, Nov 18, 2020 at 9:37 AM C W <tmrsg11 using gmail.com> wrote:

> Dear R list,
>
> I am an old-school R user. I use apply(), with(), and which() in base
> package instead of filter(), select(), separate() in Tidyverse. The idea of
> pipeline (i.e. %>%) my code was foreign to me for a while. It makes the
> code shorter, but sometimes less readable?
>
> With ggplot2, I just don't understand how it is organized. Take this code:
>
> > ggplot(diamonds, aes(x=carat, y=price)) + geom_point(aes(color=cut)) +
> geom_smooth()
>
> There are three plus signs. How do you know when to "add" and what to
> "add"? I've seen more plus signs.
>
> To me, aes() stands for aesthetic, meaning looks. So, anything related to
> looks like points and smooth should be in aes(). Apparently, it's not the
> case.
>
> So, how does ggplot2 work? Could someone explain this for an old-school R
> user?
>
> Thank you!
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list