Tidyr tree biomass (solution)

Exercise
Output solution

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
Rows: 61965 Columns: 7
── Column specification ────────────────────────────────────────────────────────
Delimiter: "\t"
chr (2): PlotID, SpCode
dbl (5): TreeGirth1, TreeGirth2, TreeGirth3, TreeGirth4, TreeGirth5

ℹ 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

# A tibble: 65,889 × 4
   PlotID SpCode   stem       girth
   <chr>  <chr>    <chr>      <dbl>
 1 BSP70  Acaccaes TreeGirth1    25
 2 BSP70  Acaccaes TreeGirth1    25
 3 BSP70  Acaccaes TreeGirth1    28
 4 BSP70  Acaccaes TreeGirth1    38
 5 BSP70  Acaccaes TreeGirth1    54
 6 BSP100 Acaccate TreeGirth1    12
 7 BSP100 Acaccate TreeGirth1    13
 8 BSP100 Acaccate TreeGirth1    14
 9 BSP100 Acaccate TreeGirth1    15
10 BSP100 Acaccate TreeGirth1    16
# ℹ 65,879 more rows

2

[1] 308.8525

3

[1] 8.276057

4

# A tibble: 65,889 × 6
   PlotID SpCode   stem       girth diameter   mass
   <chr>  <chr>    <chr>      <dbl>    <dbl>  <dbl>
 1 BSP70  Acaccaes TreeGirth1    25     7.96  23.6 
 2 BSP70  Acaccaes TreeGirth1    25     7.96  23.6 
 3 BSP70  Acaccaes TreeGirth1    28     8.91  31.4 
 4 BSP70  Acaccaes TreeGirth1    38    12.1   68.0 
 5 BSP70  Acaccaes TreeGirth1    54    17.2  165.  
 6 BSP100 Acaccate TreeGirth1    12     3.82   3.68
 7 BSP100 Acaccate TreeGirth1    13     4.14   4.51
 8 BSP100 Acaccate TreeGirth1    14     4.46   5.44
 9 BSP100 Acaccate TreeGirth1    15     4.77   6.47
10 BSP100 Acaccate TreeGirth1    16     5.09   7.62
# ℹ 65,879 more rows

5

[1] 26710042

6

# A tibble: 242 × 2
   GenusCode   biomass
   <chr>         <dbl>
 1 Acac       12849.  
 2 Acro       17899.  
 3 Acti       64199.  
 4 Aegl           6.47
 5 Agla      448027.  
 6 Agro          23.6 
 7 Aila        1589.  
 8 Alan        6740.  
 9 Albi       37902.  
10 Allo        1654.  
# ℹ 232 more rows

7

`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.