knitr::opts_chunk$set(echo = TRUE)
Do final creation of synthetic varibles
library(here) library(reshape2) library(car) library(stringi) library(tibble)
Data has been cleaned to removed typos and basic prep done for statistics
filename <- "mencia_cleaned.csv" filename <- here::here("data-raw", "data-raw-mencia", "mencia_all_captures_by_year", filename) mencia <- read.csv(filename)
mencia$site <- factor(mencia$site, levels = c("La Cueva", "La Caoba", "Morelia", "El Corral", "Aceitillar"))
ID is unique for each individual some individuals captured multiple times w/in years some re-captured between years. Make unique ID to seperate out w/in year recaps
mencia$ID.yr <- with(mencia, paste(band, year), sep = ".")
447 re-captured in different sites
length(unique(mencia$band)) #3143 length(unique(mencia$ID.yr)) #3590 length(unique(mencia$ID.yr)) - length(unique(mencia$band))
161 re-captured in different sites (w/in yr OR between yr)
mencia$ID.site <- with(mencia, paste(band, site), sep = ".") length(unique(mencia$ID.site))-length(unique(mencia$band))
mencia$sex.M <- with(mencia, ifelse(sex == "M","M","other")) # has to be sexed to count #mencia$sex.M[is.na(mencia$sex.M)] <- "other" mencia$sex.M <- factor(mencia$sex.M)
Combine all AHY and beyond catetories
Has to be aged to count
summary(mencia$age) mencia$age <- as.character(mencia$age) #HY and SY = "age1" mencia$age.AHY.01 <- gsub("^HY","age1", mencia$age) mencia$age.AHY.01 <- gsub("^SY","age1",mencia$age.AHY.01) mencia$age.AHY.01 <- gsub("^AHY","age2",mencia$age.AHY.01) mencia$age.AHY.01 <- gsub("^ASY","age2",mencia$age.AHY.01) mencia$age.AHY.01 <- factor(mencia$age.AHY.01 ) summary(mencia$age.AHY.01 )
filename <- "mencia_annual_final.csv" filename <- here::here("data-raw", filename) write.csv(mencia, file = filename,row.names = F)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.