Using_fishdata

Conor Neilson

2018-02-13

Combining datasets

The four datasets can be successfully combined to address different scientific questions.

Comparitive adult and juvenile morphologies

library(fishdata)
library(dplyr)
## 
## 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
data("adult_morphologies")
data("juvenile_morphologies")
morphs <- bind_rows(adult_morphologies, juvenile_morphologies)

Adding max age to the morphology datasets

data("adult_morphologies")
data("adult_growths")
adult_growths %>% 
  group_by(fish_id) %>% 
  summarise(age = max(increment)) %>% 
  right_join(adult_morphologies, by = "fish_id")
## # A tibble: 48 x 7
##    fish_id   age standard_length body_depth site    month age_class
##    <chr>   <dbl>           <dbl>      <dbl> <chr>   <chr> <chr>    
##  1 R1.1      274            5.63      0.817 River_2 April adult    
##  2 R1.2      317            5.84      0.768 River_2 April adult    
##  3 R1.3      298            5.88      0.824 River_2 April adult    
##  4 R1.4      305            5.33      0.543 River_2 April adult    
##  5 R1.7      291            6.87      0.827 River_2 April adult    
##  6 R1.9      296            4.75      0.559 River_2 April adult    
##  7 R1.10     288            5.18      0.572 River_2 April adult    
##  8 R1.11     370            6.59      0.629 River_2 April adult    
##  9 R1.13     309            7.58      1.18  River_2 April adult    
## 10 R1.14     358            5.70      0.646 River_2 April adult    
## # ... with 38 more rows
data("juvenile_growths")
data("juvenile_morphologies")
juvenile_growths %>% 
  group_by(otolith_id) %>% 
  summarise(age = max(increment)) %>% 
  right_join(juvenile_morphologies, by = "otolith_id")
## # A tibble: 496 x 9
##    otolith_id   age fish_id site     day month  standard_length body_depth
##         <int> <dbl> <chr>   <chr>  <int> <chr>            <dbl>      <dbl>
##  1         34   168 582     River…    13 Octob…            42.5       3.53
##  2         20   179 583     River…    13 Octob…            46.7       3.92
##  3        359   189 584     River…    13 Octob…            45.5       3.82
##  4        422   185 585     River…    13 Octob…            43.5       3.92
##  5         54   182 586     River…    13 Octob…            44.9       3.57
##  6        471   174 587     River…    13 Octob…            46.6       4.03
##  7        335   176 588     River…    13 Octob…            47.5       4.31
##  8        145   202 589     River…    13 Octob…            47.5       4.10
##  9        125   201 292     River…    12 Octob…            46.6       4.62
## 10        250   192 301     River…    12 Octob…            45.1       4.43
## # ... with 486 more rows, and 1 more variable: age_class <chr>