Set up R console:

library(dplyr)
library(ggplot2)

acacia <- read.csv("http://www.esapubs.org/archive/ecol/E095/064/ACACIA_DREPANOLOBIUM_SURVEY.txt", sep="\t")

Get familiarized with metadata - Acacia drepanolobium Surveys

Basics

ggplot(acacia, aes(x = CIRC, y = AXIS1)) + 
  geom_point()
ggplot(acacia, aes(x = CIRC, y = log10(AXIS1))) +
  geom_point()
ggplot(acacia, aes(x = CIRC, y = AXIS1)) +
  geom_point() +
  scale_y_log10()
ggplot(acacia, aes(x = CIRC, y = AXIS1)) +
  geom_point(size = 3, color = "red") +
  scale_y_log10() +
  labs(x = "Circumference [cm]", y = "Canopy Width [m]",
       title = "Acacia Survey at UHURU") +
  annotation_logticks(sides = "l") +
  theme_bw()

Do Exercise 2 - Mass vs Metabolism.

Grouping

ggplot(acacia, aes(x = CIRC, y = AXIS1, color = ANT)) +
  geom_point()
ggplot(acacia, aes(x = CIRC, y = AXIS1)) +
  geom_point() +
  facet_wrap(~ANT)

Do Tasks 1-4 in Exercise 3 - Adult vs Newborn Size.

Layers

ant_acacia <- filter(acacia, ANT %in% c("CM", "CS", "TP"))
ggplot(ant_acacia, aes(x = CIRC, y = AXIS1)) +
  geom_point() +
  geom_smooth(method = "lm") +
  facet_wrap(~ANT)
ggplot(acacia, aes(x = CIRC, y = AXIS1)) +
  geom_point() +
  geom_point(data = acacia, aes(x = CIRC, y = AXIS2), color = "red") +
  labs(x = "Circumference [cm]", y = "Canopy Width [m]")
ggplot(acacia, aes(x = CIRC, y = AXIS1)) +
  geom_point() +
  geom_point(aes(y = AXIS2), color = "red") +
  labs(x = "Circumference [cm]", y = "Canopy Width [m]")

Do Task 5 in Exercise 3 - Adult vs Newborn Size.

Statistical transformations

ggplot(acacia, aes(x = ANT)) + 
  geom_bar()
ggplot(acacia, aes(x = CIRC)) +
  geom_histogram()
ggplot(acacia, aes(x = CIRC, fill = ANT)) +
  geom_histogram(bins = 15) +
  scale_x_log10() +
  annotation_logticks(sides = "b") +
  facet_wrap(~TREATMENT) +
  labs(x = "Circumference", y = "Number of Individuals") +
  theme_bw(base_size = 16)

Additional information