knitr::opts_chunk$set(echo = TRUE)
Reshape to wide for demographic info, calculate summaries, etc
library(here) library(reshape2) library(car) library(stringi)
Data has been cleaned to removed typos and basic prep done for statistics
filename <- "mencia_cleaned.csv" filename <- 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"))
Identify first instance of bird occuring. (I checked - all birds have the same age code even if recaptured; recaps rare regardless)
# i.unique <- match(unique(mencia$band),mencia$band) # # length(which(duplicated(mencia$band) == TRUE))
# age.cast <- dcast(data= mencia[i.unique,], # formula = species + status ~ site, # value.var = "site", # fun.aggregate = length) # # # age.cast[which(age.cast$status == "mig"), ]
# sex.cast <- dcast(data= mencia[i.unique,], # formula = species + status ~ site + sex, # value.var = "site", # fun.aggregate = length) # # # sex.cast[which(sex.cast$status == "mig"), ]
save to raw data folder
# focal spp and summary output # filename <- "focals_herbdat_16.csv" # filename <-here("data-raw","data-raw-herb","herb_veg_16", # filename) # write.csv(focals.herbdat.16, # file = filename,row.names = F) # # # #cover by species # filename <- "cover_by_spp_herbdat_16.csv" # filename <-here("data-raw","data-raw-herb","herb_veg_16", # filename) # write.csv(cover.by.spp.herbdat.16, # file = filename,row.names = F) # # # # #pres abs by spp # filename <- "presabs_by_spp_herbdat_16.csv" # filename <-here("data-raw","data-raw-herb","herb_veg_16", # filename) # write.csv(presabs.by.spp.herbdat.16, # file = filename,row.names = F)
saved to "data" folder where working data for real analyses is stored
# filename <- "focals_herbdat_16.RData" # filename <-here("data", # filename) # save(focals.herbdat.16, # file = filename,row.names = F)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.