The SRKW orca data is included as a dataframe. Each row is an individual, with birth and death information.

data(orca)
head(orca)
#>     X animal birth death  pod matriline  mom sexF1M2 includeFec includeSurv
#> 1 485   J001  1951  2010 J001      J002 <NA>       2          1           1
#> 2 486   J002  1911  2017 J001      J002 <NA>       1          1           1
#> 3 487   J003  1953  1995 J001      J016 <NA>       2          1           1
#> 4 488   J004  1957  1995 J001      J008 <NA>       1          1           1
#> 5 489   J005  1938  1997 J001      J009 <NA>       1          0           1
#> 6 490   J006  1956  1998 J001      J008 <NA>       2          1           1
#>   population
#> 1       SRKW
#> 2       SRKW
#> 3       SRKW
#> 4       SRKW
#> 5       SRKW
#> 6       SRKW

But for modeling, it’s more useful to work with an expanded version, where every animal-year combination gets its own row. The expand() function does this step,

data(ages2stages)
whaleData = srkwstatus::expand(orca, ages2stages =ages2stages)

Then we can do all kinds of filtering for various analyses – e.g. 

whaleData = whaleData[whaleData$birth > 1970,]

# A handful of unknown sexes need to be randomly filled in
whaleData$sexF1M2[which(whaleData$sexF1M2==0)] = sample(c(1,2), size=length(which(whaleData$sexF1M2==0)), replace=T)

whales_since76 = as.character(orca$animal[orca$birth > 1970])

sub = whaleData[which(whaleData$animal%in%whales_since76 & whaleData$population=="SRKW" & !is.na(whaleData$gave_birth) & whaleData$sexF1M2=="1" & whaleData$age>=10 & whaleData$age< 43), ]
sub$animal = as.factor(sub$animal)


# filter out females alive in current year
currently_alive = dplyr::filter(sub, year == year.end, is.na(death))
knitr::kable(currently_alive)
year animal X birth death pod matriline mom sexF1M2 includeFec includeSurv population age alive gave_birth
2026 J022 506 1985 NA J001 J009 J010 1 1 1 SRKW 41 1 0
2026 J031 516 1995 NA J001 J008 J011 1 1 1 SRKW 31 1 0
2026 J035 521 1998 NA J001 J009 J017 1 1 0 SRKW 28 1 0
2026 J036 523 1999 NA J001 J016 J016 1 1 1 SRKW 27 1 0
2026 J037 524 2001 NA J001 J002 J014 1 1 1 SRKW 25 1 0
2026 J041 528 2005 NA J001 J008 J019 1 1 1 SRKW 21 1 0
2026 J046 533 2009 NA J001 J009 J028 1 1 1 SRKW 17 1 0
2026 J053 540 2015 NA J001 J009 J017 1 1 1 SRKW 11 1 0
2026 K016 563 1985 NA K001 K003 K003 1 1 1 SRKW 41 1 0
2026 K020 567 1986 NA K001 K007 K013 1 1 1 SRKW 40 1 0
2026 K022 569 1987 NA K001 K004 K012 1 1 1 SRKW 39 1 0
2026 K027 574 1994 NA K001 K007 K013 1 1 1 SRKW 32 1 0
2026 K042 589 2008 NA K001 K003 K014 1 1 1 SRKW 18 1 0
2026 K043 590 2010 NA K001 K004 K012 1 1 1 SRKW 16 1 0
2026 L072 655 1986 NA L001 L026 L043 1 1 1 SRKW 40 1 0
2026 L077 660 1987 NA L001 L012 L011 1 1 1 SRKW 39 1 0
2026 L082 665 1990 NA L001 L004 L055 1 1 1 SRKW 36 1 0
2026 L083 666 1990 NA L001 L021 L047 1 1 1 SRKW 36 1 0
2026 L086 669 1991 NA L001 L004 L004 1 1 1 SRKW 35 1 0
2026 L090 673 1993 NA L001 L026 L026 1 1 1 SRKW 33 1 0
2026 L091 674 1995 NA L001 L021 L047 1 1 1 SRKW 31 1 0
2026 L094 677 1995 NA L001 L012 L011 1 1 1 SRKW 31 1 0
2026 L103 686 2003 NA L001 L004 L055 1 1 1 SRKW 23 1 0
2026 L113 696 2009 NA L001 L012 L094 1 1 1 SRKW 17 1 0
2026 L118 701 2011 NA L001 L004 L055 1 1 1 SRKW 15 1 0
2026 L119 702 2012 NA L001 L012 L077 1 1 1 SRKW 14 1 0
# find last birth for each of these
last_birth = group_by(dplyr::filter(sub, gave_birth==1), animal) %>% 
  dplyr::summarise(last_birth = max(year[which(gave_birth==1)]))
last_birth$last_birth[!is.finite(last_birth$last_birth)] = NA

currently_alive = dplyr::left_join(currently_alive, last_birth) %>% 
  dplyr::mutate(unlikely_future_mom="") %>%
  dplyr::select(animal,age,last_birth,unlikely_future_mom) %>% data.frame()

Notes on demographic modeling

As a cautionary note, there may be interest in using these data to test correlations with prey (salmon) indices or other environmental drivers. There are several very nuanced and important things to note about different subsets of these data.

First, ages on animals in the beginning of the surveys were often ‘guessed’, and in the cases of females, assigned an age of 40 based on the last observed birth. This procedure will generate bias (many of the animals being < 40 during their last birth), so these animals have been excluded from fecundity-at-age analyses, or only used in stage-based survival estimates. The includeSurv and includeFec columns are used to designate most of these cases (1 = include, 0 = exclude).

Second, a handful of deaths are either tied to human disturbance (direct or indirectly associated with ship strikes) or are not independent. Calves that died at the same time as their moms are not independent (J24, J54, K39, L97, L104). Other animals are associated with vessel strikes (L98), satellite tag infections (L95) or unknown trauma (L112). For the latter three animals, it is possible to include the years they survive as data, and replace the death data with an NA. For example:

whaleData[which(whaleData$animal %in% c("L095","L098","L112") & whaleData$alive==0),] = NA