Graphing acacia ants (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("ACACIA_DREPANOLOBIUM_SURVEY.txt", na = c("dead"))
  1. Make a scatter plot with CIRC on the x axis and AXIS1 (the maximum canopy width) on the y axis. Label the x axis “Circumference” and the y axis “Canopy Diameter”.
  2. Make a scatter plot with AXIS1 on the x axis and AXIS2 on the y axis (the two measurements of canopy diameter). Set the point size to 2 and color to "darkgreen". Label the x axis “Canopy Diameter Axis 1” and the y axis “Canopy Diameter Axis 2”.
  3. Look at the relationship between AXIS1 and AXIS2 on only the full herbivore exclosures by: filtering the data so that it only contains the plots “S1TOTAL”, “S2TOTAL”, and “S3TOTAL”, using drop_na() to remove rows where either AXIS1 or AXIS2 are NA, and making a scatter plot of this filtered data with AXIS1 on the x axis and AXIS2 on the y axis. Label the x axis “Canopy Diameter Axis 1” and the y axis “Canopy Diameter Axis 2”.
CautionOutput solution

Code solution for Graphing Acacia and Ants


Attaching package: 'dplyr'
The following objects are masked from 'package:stats':

    filter, lag
The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union
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

Warning: Removed 4 rows containing missing values or values outside the scale range
(`geom_point()`).

2

Warning: Removed 4 rows containing missing values or values outside the scale range
(`geom_point()`).

3