-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
phylobeta error #9
Comments
Hi, @natirubirb. Can you please provide a reproducible example? |
I think you meant to tell me to check for the difference on the betatree with the community column labels. I used: setdiff(tiplabels(treebeta),colnames(hope)) # I got this error When I compared my previous tree (timedtreeC) to the betatree. It does exclude the species that were not on my community. So that works I have 337 species in my tree and 337 columns in my community with the same labels. I am attaching the files needed. please change extention of betatree to nwk. library(phyloregion) betacom<-read.csv("betacommunity.csv") hope<-dense2sparse(betacom) phylobeta(hope, treebeta) |
The problem is that your names don't match. setdiff(colnames(betacom), treebeta$tip.label)
# [1] "plotID" "Andropogon_gerardii"
# [3] "Chasmanthium_sessiliflorum" "Cyperus_filiformis"
# [5] "Cyperus_plukenetii" "Cyperus_retrorsus"
# [7] "Dichanthelium_angustifolium" "Dichanthelium_ovale"
# [9] "Dichanthelium_villosissimum" "Diodia_teres"
#[11] "Ionactis_linariifolius" "Nyssa_sylvatica"
#[13] "Oxalis_corniculata" "Photinia_pyrifolia"
#[15] "Pleopeltis_polypodioides" "Polygala_grandiflora"
#[17] "Polystichum_acrostichoides" "Pteridium_aquilinum"
#[19] "Saccharum_alopecuroides" "Schizachyrium_scoparium"
#[21] "Serenoa_repens" "Vitis_rotundifolia"
#[23] "Xyris_caroliniana" You can select the columns from your community data that match your new_betacom <- betacom %>%
dplyr::select(-setdiff(colnames(betacom), treebeta$tip.label))
hope <- dense2sparse(new_betacom)
result_phybeta <- phylobeta(hope, treebeta)
str(result_phybeta)
#List of 3
# $ phylo.beta.sim: 'dist' num [1:20100] 0.158 0.199 0.255 0.258 0.331 ...
# ..- attr(*, "Size")= int 201
# ..- attr(*, "Diag")= logi FALSE
# ..- attr(*, "Upper")= logi FALSE
# $ phylo.beta.sne: 'dist' num [1:20100] 0.1078 0.0656 0.1497 0.148 0.1532 ...
# ..- attr(*, "Size")= int 201
# ..- attr(*, "Diag")= logi FALSE
# ..- attr(*, "Upper")= logi FALSE
# $ phylo.beta.sor: 'dist' num [1:20100] 0.266 0.265 0.404 0.406 0.485 ...
# ..- attr(*, "Size")= int 201
# ..- attr(*, "Diag")= logi FALSE
# ..- attr(*, "Upper")= logi FALSE |
Hi @natirubirb,
I discovered a little problem with your data. There are several duplicated labels for your plotID, e.g. "NC", "UN", "OF4", ...
If you want to combine the occurrences in one plot execute the following lines, if not skip them:
Now we are almost there:
Now we get a warning, which we understand. So now take just the labels
Cheers, |
Hi Klaus, Thank you for your input and suggestions. You are right, I have some replicates. My data frame originally had 3 columns: siteID, PlotID and subplotID. I was getting an error because of that and temporarily trimmed the data to only use plot ID without combining the data. Now I know that would create an error too. I was wondering about how you could compare the same community (plotID) from different sites (siteID) . I was hoping to compare the differences in phylogenetic diversity of similar communities in different sites. For example, for one part of my work, I have some native community plots (3 replicates) and I would like to compare them with 3 site that has been restored in the same way (fire at the same interval). Seems like I would have to choose only one plot per site if I understand the function correctly. Another question, I don't think I understand how the comparison are done with the rows. does the function compares each row against each other? is there any way to group rows? Thank you Klaus and paratol for your help! |
Hi! I am having some trouble running the function phylobeta. I get the following error: "Error in phylobeta_core(x, phy) : Labels of community matrix and tree differ!"
I don't think that is the issue because the labels are the same. I double checked and I created a new tree using this code: treebeta<-keep.tip(timedtreeC,intersect(timedtreeC$tip.label,colnames(hope)))
hope: is the name of my community matrix.
I would appreciate any help with this issue. Thanks! Natali
The text was updated successfully, but these errors were encountered: