Day 6: Change your graph type with this one tweak

Over the last week, we learned how to use ggplot to create a graph.

We specifically drew a line of best fit using geom_smooth(method="lm")

Graphs aren't limited to just this, however...

In addition to a scatter plot (using geom_point), you can use the following:


1. geom_line(): Line plots

- Example: `geom_line()`

2. geom_bar() / geom_col(): Bar charts

- Example: geom_bar(stat = "count") or geom_col()

3. geom_histogram(): Histograms

- Example: geom_histogram(binwidth = 10)`

4. geom_boxplot(): Box plots

- Example: geom_boxplot()

5. geom_density(): Density plots

- Example: geom_density()


There are several others but these are the ones you'll use more often. Make a list of it for future reference :)

Come tomorrow, we'll move on from visualising data to something new.

(Read tomorrow's mail to find out 🤪)

We'll revisit graphs at a future date but it's also important to get a well-rounded introduction to R.

If you've had any questions from the past editions shoot me a reply :)

(or if you're new, let me know which emails you've missed and I'll send them your way)

p.s.

I've decided to mail you only from Monday to Friday so you can catch up over the weekend

If you haven't? Don't worry. Catch up when you can.

See you in the next one

Previous
Previous

Day 7: Show that 1+1 = 3

Next
Next

Day 5 : I'll wait for you, but there's a quiz