Hi all,
I am an undergrad student working on a project measuring the species-specific relationships between bird populations and bark beetle caused tree mortality in a wilderness area of Colorado. I have a fairly large dataset of 160 points in which distance sampled point counts were conducted over this past summer along with several field-collected and remotely sensed covariates corresponding to each point (and observation in the dataset). So far, I have had generally good success working through the analysis using the Distance package in R, but have continually encountered the following error when using the "formula=" argument in data subsetted for different species to model relationships with the other covariates: "Error in checkdata(data, region_table, sample_table, obs_table, formula) :Variable(s): obsRCKI are in the model formula but not in the data." This is just an example, but I continually get the same error in all other covariates (ndviclass, ndvi, temp, wind, elevation, timecategory, mortalityseverity, etc.) being modeled, and for all other species-subsetted datasets. I do not however get the error in the non-subsetted dataset (see screenshot) or when the analysis is run without any covariates in the subsetted data (see screenshot). I have ensured there are no missing values anywhere in the subsetted datasets, and have checked the data types to ensure numeric values are in fact numeric (as.numeric function) and character values are read as such (as.character function).
I have also ensured that I am using the most current version of R, RStudio, and the Distance package for the analysis. I have included screenshots of my dataset, my code for subsetting the data and subsequent attempts for analysis at the species level. To rule out errors in subsetting, I have also attempted exporting the subsetted data to a csv, checking it over in Excel, and re-importing it with the code using the newly imported csv - same error. Potentially this is an easy fix as I am only in my first few months of using the distance package, but have spent substantial time attempting to resolve it with no luck so far. Any help or suggestions would be greatly appreciated!
Thanks so much,
Arrow Myers
Western Colorado University