Hi all,
I'm extremely new to unmarked, and I've been struggling with getting my data set up properly to even begin the modeling steps.
I have repeated count data (3 visits each year) for 24 sites over 6 years, and my main goals are to identify the impact certain variables have on the species abundance overtime (I'll be modeling for three separate amphibian species). This data includes forested sites that were harvested at some point during the study, so we have species abundance and other variable data collected pre- and post- harvest as well as control sites that weren't harvested at all throughout the 6 years. I'm calling the pre-, post-, and no-harvest my different treatment groups, as I really want to know how the abundance was impacted by the harvests.
I believe I have my data files set up properly with one row per site and one column per visit. The observation/detection data we have are date and effort for each survey, and they have more columns since the dates and efforts were different for each individual survey. My site covariate file just has one column for each primary visit (so for each year), and right now I've only included treatment as a site covariate because I wanted to get an idea of how to work through unmarked before I included too many site covariates.
I read in my data and go to set up the unmarked frame and get an error with obsCovs:
wf.data <- read.csv("EP_wf_abundance_unm_03302022.csv",row.names = "site",header=TRUE)
obs.data <- read.csv("EP_unm_obscovariates_03302022.csv",row.names = "site",header=TRUE)
site.data <- read.csv("EP_unm_sitecovariates_04212022.csv",row.names = "site",header=TRUE)
wfUMF <- unmarkedFramePCO(y = as.matrix(wf.data), numPrimary = 6, obsCovs = list(date = obs.data[,2:19], effort = obs.data[,20:37]), siteCovs = site.data[,2], yearlySiteCovs = list(treatment = site.data[,2:7]))
Error in `[.data.frame`(obs.data, , 20:37) : undefined columns selected
Typically this type of error would have to do with a missing comma in the formula for selecting the columns of the data frame I'm referring to, but I have the comma in the code, and those columns are definitely in the data file I called from. This is likely a silly error I've made, but I don't know how to fix this.
I've tried running it without obsCovs and then I get the same error with the yearlySiteCovs, too. I must be missing something in my code.
Any help with this is much appreciated, thank you!
-Meg