Closed coreytcallaghan closed 6 years ago
cool let's chat quickly, here is some code I hadn't committed to try to get a general matching function where we can vary the predictor variables we pass in...
traits$"SCIENTIFIC_NAME"<-row.names(traits)
list_of_predictors2<-c("SCIENTIFIC_NAME",list_of_predictors)
traits %>%
select_( .dots =list_of_predictors2) %>%
filter_all(all_vars(!is.na(.))) -> predictors
sp_list_for_analysis<-Reduce(intersect,list(predictors$sp,aus_bird_tree$tip.label,response_variables$SCIENTIFIC_NAME))
tree_subset_with_data<-drop.tip(aus_bird_tree,aus_bird_tree$tip.label[!aus_bird_tree$tip.label%in%sp_list_for_analysis])
temp<-inner_join(predictors,response_variables,by=c("SCIENTIFIC_NAME"))
out<- subset(temp,temp$SCIENTIFIC_NAME%in%sp_list_for_analysis)
list_of_predictors3<-c(list_of_predictors,"urban_median")
out %>%
select_( .dots =list_of_predictors3) ->dd
rownames(dd)<-out$SCIENTIFIC_NAME
Hey guys.
I went ahead and implemented the taxonomy lookup table created in #6 throughout the analysis. I think.
I suggest remaking the repository. I changed a bit of some of the scripts, but I think it all worked out alright. We now have a pseudo final subset of species - only looking at three explanatory variables, it looks like there are 569 species included in the analysis.
Some of the figures were remade as well when I did it - such as the bird_urbanness_phylo.pdf
I changed the phylo funx script a bit as it was calling "traits" before, but now I call the "ms" file, which is made in the traits funx script. The ms df should already be the complete set of traits and of species.
It might be actually easier to just cut some of the stuff out of cleaning in the phylo funx script as most of the cleaning can be done in the traits funx script... In other words, shouldn't have to recreate the dataframe as it currently is doing. But, will scrutinize that step when it gets closer to filling out the model.
Also, note that I only amended the script for the
lme4
model version and not thephylolm
version.Sounds like, based on #17 we might be switching back to
phylolm
though to getrr2
easier?