Assignment #9 - Visualization in R – Base Graphics, Lattice, and ggplot2
R code: GitHub link Generated plots: Scatter plot: Histogram: Conditional scatter plot (lattice): Scatter with linear trend (ggplot2): Discussion: How do the syntax and workflow differ between base, lattice, and ggplot2? Base R is very simple and step-by-step, where you first call 'plot( )', and then begin to add what you want line by line, such as points, lines, or legends. With lattice, you establish the description of the plot once with a formula 'xyplot(y ~ x | group, data=df)', with optional formatting lines, and then it renders the plot from that. It is more rigid with edits and requires you to edit the actual code rather than additional lines. Finally, ggplot2 is built together, data + aesthetics + layers 'ggplot(df, aes(x, y, color=group)) + geom_point( ) + geom_smooth( )', therefore allowing it to be easily tweaked. Which system gave you the most control or produced the most “publication‑quality” output with minimal code? I would say that ggplot2 pr...