Re: [R-sig-phylo] more problems with branch names
Looks like this may be because your row names in your data frame have spaces, while your tree tip labels do not. Try: rownames(example)-sub( ,,rownames(example)) example-example[tree$tip.label,] Help? - Liam -- Liam J. Revell University of Massachusetts Boston web: http://faculty.umb.edu/liam.revell/ email: liam.rev...@umb.edu blog: http://phytools.blogspot.com On 5/9/2012 5:13 PM, Agus Camacho wrote: Dear all, I had the same problem as T. Gamble and tried the advice from L. Revell and Rich over my own tree (attached), all of the hints produced a df with Nas. Also, I cant see any difference between rownames on my matrix and tree tip labels... Could anyone give me a hint about what i am doing wrong here? Thanks in advance, Agus PS: There it goes what I did: First from Liam's hint: example- read.csv(example.csv,header=TRUE,row.names=1) example vara varb C. leiolepis 1a C. nicterus 2b C. sinebrachiatus3c S. catimbau 4a N. ablephara 5b P. erythrocercus 6c P. tetradactylus 7a V. rubricauda8b V. rubricaudavac 9c M. maximiliani 10a P. paeminosus 11b tree$tip.label [1]C.leiolepis C.nicterusC.sinebrachiatus S.catimbau [5]N.ablephara P.erythrocercus P.tetradactylus V.rubricauda [9]V.rubricaudavac M.maximiliani P.paeminosus example-example[tree$tip.label,] example vara varb NA NANA NA.1NANA NA.2NANA NA.3NANA NA.4NANA NA.5NANA NA.6NANA NA.7NANA NA.8NANA NA.9NANA NA.10 NANA Now, Rich's hint: match(tree$tip.label, rownames(example)) - match match [1] NA NA NA NA NA NA NA NA NA NA NA -- Agustín Camacho Guerrero. Doutorando em Zoologia. Laboratório de Herpetologia, Departamento de Zoologia, Instituto de Biociências, USP. Rua do Matão, trav. 14, nº 321, Cidade Universitária, São Paulo - SP, CEP: 05508-090, Brasil. ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Re: [R-sig-phylo] more problems with branch names
Hi Agus, From what you have posted, it looks as though you have a white space between the genus abbreviation and the species name in the row names for your csv but not for the tree's tip labels. Try running the following after reading it in but before attempting to match the names to the tips in the tree, and see if that helps rownames(example) - gsub( ,, rownames(example)); cheers, Graham On May 9, 2012, at 2:13 PM, Agus Camacho wrote: Dear all, I had the same problem as T. Gamble and tried the advice from L. Revell and Rich over my own tree (attached), all of the hints produced a df with Nas. Also, I cant see any difference between rownames on my matrix and tree tip labels... Could anyone give me a hint about what i am doing wrong here? Thanks in advance, Agus PS: There it goes what I did: First from Liam's hint: example - read.csv(example.csv,header=TRUE,row.names=1) example vara varb C. leiolepis 1a C. nicterus 2b C. sinebrachiatus3c S. catimbau 4a N. ablephara 5b P. erythrocercus 6c P. tetradactylus 7a V. rubricauda8b V. rubricaudavac 9c M. maximiliani 10a P. paeminosus 11b tree$tip.label [1] C.leiolepis C.nicterus C.sinebrachiatus S.catimbau [5] N.ablephara P.erythrocercus P.tetradactylus V.rubricauda [9] V.rubricaudavac M.maximilianiP.paeminosus example-example[tree$tip.label,] example vara varb NA NA NA NA.1NA NA NA.2NA NA NA.3NA NA NA.4NA NA NA.5NA NA NA.6NA NA NA.7NA NA NA.8NA NA NA.9NA NA NA.10 NA NA Now, Rich's hint: match(tree$tip.label, rownames(example)) - match match [1] NA NA NA NA NA NA NA NA NA NA NA -- Agustín Camacho Guerrero. Doutorando em Zoologia. Laboratório de Herpetologia, Departamento de Zoologia, Instituto de Biociências, USP. Rua do Matão, trav. 14, nº 321, Cidade Universitária, São Paulo - SP, CEP: 05508-090, Brasil. tree.jpeg___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Graham Slater Ph. D. Department of Ecology and Evolutionary Biology University of California, Los Angeles 610 Charles E. Young Drive South Los Angeles, CA 90095-1606 (424) 442-4348 gsla...@ucla.edu www.eeb.ucla.edu/gslater [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Re: [R-sig-phylo] more problems with branch names
Thanks a lot for your quick responses Liam and Graham, I was warned I could have issues with spaces, but did not see these! 2012/5/9 Graham Slater gsla...@ucla.edu Hi Agus, From what you have posted, it looks as though you have a white space between the genus abbreviation and the species name in the row names for your csv but not for the tree's tip labels. Try running the following after reading it in but before attempting to match the names to the tips in the tree, and see if that helps rownames(example) - gsub( ,, rownames(example)); cheers, Graham On May 9, 2012, at 2:13 PM, Agus Camacho wrote: Dear all, I had the same problem as T. Gamble and tried the advice from L. Revell and Rich over my own tree (attached), all of the hints produced a df with Nas. Also, I cant see any difference between rownames on my matrix and tree tip labels... Could anyone give me a hint about what i am doing wrong here? Thanks in advance, Agus PS: There it goes what I did: First from Liam's hint: example - read.csv(example.csv,header=TRUE,row.names=1) example vara varb C. leiolepis 1a C. nicterus 2b C. sinebrachiatus3c S. catimbau 4a N. ablephara 5b P. erythrocercus 6c P. tetradactylus 7a V. rubricauda8b V. rubricaudavac 9c M. maximiliani 10a P. paeminosus 11b tree$tip.label [1] C.leiolepis C.nicterus C.sinebrachiatus S.catimbau [5] N.ablephara P.erythrocercus P.tetradactylus V.rubricauda [9] V.rubricaudavac M.maximilianiP.paeminosus example-example[tree$tip.label,] example vara varb NA NA NA NA.1NA NA NA.2NA NA NA.3NA NA NA.4NA NA NA.5NA NA NA.6NA NA NA.7NA NA NA.8NA NA NA.9NA NA NA.10 NA NA Now, Rich's hint: match(tree$tip.label, rownames(example)) - match match [1] NA NA NA NA NA NA NA NA NA NA NA -- Agustín Camacho Guerrero. Doutorando em Zoologia. Laboratório de Herpetologia, Departamento de Zoologia, Instituto de Biociências, USP. Rua do Matão, trav. 14, nº 321, Cidade Universitária, São Paulo - SP, CEP: 05508-090, Brasil. tree.jpeg___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Graham Slater Ph. D. Department of Ecology and Evolutionary Biology University of California, Los Angeles 610 Charles E. Young Drive South Los Angeles, CA 90095-1606 (424) 442-4348 gsla...@ucla.edu www.eeb.ucla.edu/gslater -- Agustín Camacho Guerrero. Doutorando em Zoologia. Laboratório de Herpetologia, Departamento de Zoologia, Instituto de Biociências, USP. Rua do Matão, trav. 14, nº 321, Cidade Universitária, São Paulo - SP, CEP: 05508-090, Brasil. [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo