Graphing acacia ants histograms (solution)

NoteExercise

An experiment in Kenya has been exploring the influence of large herbivores on plants.

If ACACIA_DREPANOLOBIUM_SURVEY.txt is not in your workspace download it. Read it into R using the following command:

acacia <- read_tsv("data/ACACIA_DREPANOLOBIUM_SURVEY.txt", na = c("dead"))
  1. Make a bar plot of the number of acacia with each mutualist ant species (using the ANT column).
  2. Make a histogram of the height of acacia (using the HEIGHT column). Label the x axis “Height (m)” and the y axis “Number of Acacia”.
  3. Make a bar plot of the number of acacia in each TREATMENT. Label the x axis “Treatment” and the y axis “Number of Acacia”.
  4. Make a histogram of the circumference of acacia (using the CIRC column) with a binwidth of 5. Label the x axis “Circumference (cm)” and the y axis “Number of Acacia”.
CautionOutput solution

Code solution for Graphing Acacia and Ants Histograms

Warning: One or more parsing issues, call `problems()` on your data frame for details,
e.g.:
  dat <- vroom(...)
  problems(dat)
Rows: 157 Columns: 15
── Column specification ────────────────────────────────────────────────────────
Delimiter: "\t"
chr  (4): SITE, TREATMENT, PLOT, ANT
dbl (11): SURVEY, YEAR, BLOCK, ID, HEIGHT, AXIS1, AXIS2, CIRC, FLOWERS, BUDS...

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

1

2

`stat_bin()` using `bins = 30`. Pick better value `binwidth`.
Warning: Removed 4 rows containing non-finite outside the scale range
(`stat_bin()`).

3

4

Warning: Removed 4 rows containing non-finite outside the scale range
(`stat_bin()`).