emmanuelparadis / ape

analysis of phylogenetics and evolution

Home Page:http://ape-package.ird.fr/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

read.tree() struggling with certain tip and node labels

HedvigS opened this issue · comments

It seems like ape::read.tree() can't deal well with spaces in node and tip labels. See example below borrowed from glottolog.org

> mayan2 <- ape::read.tree(text = "((((('Aguacateco [agua1252][agu]-l-':1,'Ixil [ixil1251][ixl]-l-':1)'Ixilan [ixil1250]':1,('Mam [mamm1241][mam]-l-':1,'Tektiteko [tekt1235][ttc]-l-':1)'Mamean [mame1240]':1)'Greater Mamean [grea1277]':1,((('Kaqchikel [kaqc1270][cak]-l-':1,'Tz''utujil [tzut1248][tzj]-l-':1)'Cakchiquel-Tzutujil [cakc1244]':1,('Achi [achi1256][acr]-l-':1,'K''iche'' [kich1262][quc]-l-':1)'Quiche-Achi [quic1275]':1,'Sacapulteco [saca1238][quv]-l-':1,'Sipacapense [sipa1247][qum]-l-':1)'Core Quichean [core1251]':1,'Kekchí [kekc1242][kek]-l-':1,('Poqomam [poqo1253][poc]-l-':1,'Poqomchi'' [poqo1254][poh]-l-':1)'Poqom [poco1241]':1,'Uspanteco [uspa1245][usp]-l-':1)'Greater Quichean [grea1276]':1)'Quichean-Mamean [quic1274]':1,(((('Chol [chol1282][ctu]-l-':1,('Buena Vista Chontal [buen1245]':1,'Miramar Chontal [mira1253]':1,'Tamulté de las Sábanas Chontal [tamu1247]':1)'Tabasco Chontal [taba1266][chf]-l-':1)'Chol-Chontal [chol1281]':1,('Cholti [chol1283]-l-':1,'Chortí [chor1273][caa]-l-':1)'Chorti-Cholti [chor1272]':1,'Epigraphic Mayan [epig1241][emy]-l-':1)'Cholan [chol1287]':1,(('Chanal Cancuc [chan1320]':1,'Tenango [tena1239]':1)'Tzeltal [tzel1254][tzh]-l-':1,'Tzotzil [tzot1259][tzo]-l-':1)'Tzeltalan [tzel1253]':1)'Cholan-Tzeltalan [chol1286]':1,(('Chuj [chuj1250][cac]-l-':1,'Tojolabal [tojo1241][toj]-l-':1)'Chujean [chuj1249]':1,(('Akateko [west2635][knj]-l-':1,'Popti'' [popt1235][jac]-l-':1,'Q''anjob''al [qanj1241][kjb]-l-':1)'Kanjobal-Jacaltec [kanj1263]':1,('Motozintleco [moto1243]':1,'Tuzanteco [tuza1238]':1)'Mocho [moch1257][mhc]-l-':1)'Kanjobalan [kanj1262]':1)'Kanjobalan-Chujean [kanj1261]':1)'Western Mayan [west2865]':1,(('Itzá [itza1241][itz]-l-':1,'Mopán Maya [mopa1243][mop]-l-':1)'Mopan-Itza [mopa1242]':1,(('Lacanjá [laca1244]':1,'Najá [naja1242]':1)'Lacandon [laca1243][lac]-l-':1,'Yucatec Maya [yuca1254][yua]-l-':1)'Yucatec-Lacandon [yuca1253]':1)'Yucatecan [yuca1252]':1)'Core Mayan [core1254]':1,('Chicomuceltec [chic1271][cob]-l-':1,'Huastec [huas1242][hus]-l-':1)'Huastecan Mayan [huas1241]':1)'Mayan [maya1287]':1;")
> 
> mayan2$node.label
 [1] "Mayan"               "CoreMayan"           "Quichean-Mamean"     "GreaterMamean"       "Ixilan"              "Mamean"              "GreaterQuichean"    
 [8] "CoreQuichean"        "Cakchiquel-Tzutujil" "Quiche-Achi"         "Poqom"               "WesternMayan"        "Cholan-Tzeltalan"    "Cholan"             
[15] "Chol-Chontal"        "TabascoChontal-l-"   "Chorti-Cholti"       "Tzeltalan"           "Tzeltal-l-"          "Kanjobalan-Chujean"  "Chujean"            
[22] "Kanjobalan"          "Kanjobal-Jacaltec"   "Mocho-l-"            "Yucatecan"           "Mopan-Itza"          "Yucatec-Lacandon"    "Lacandon-l-"        
[29] "HuastecanMayan"

This works for me:

R> mayan2$node.label
 [1] "'Mayan [maya1287]'"                  
 [2] "'Core Mayan [core1254]'"             
 [3] "'Quichean-Mamean [quic1274]'"        
 [4] "'Greater Mamean [grea1277]'"         
 [5] "'Ixilan [ixil1250]'"                 
 [6] "'Mamean [mame1240]'"                 
 [7] "'Greater Quichean [grea1276]'"       
 [8] "'Core Quichean [core1251]'"          
 [9] "'Cakchiquel-Tzutujil [cakc1244]'"    
[10] "'Quiche-Achi [quic1275]'"            
[11] "'Poqom [poco1241]'"                  
[12] "'Western Mayan [west2865]'"          
[13] "'Cholan-Tzeltalan [chol1286]'"       
[14] "'Cholan [chol1287]'"                 
[15] "'Chol-Chontal [chol1281]'"           
[16] "'Tabasco Chontal [taba1266][chf]-l-'"
[17] "'Chorti-Cholti [chor1272]'"          
[18] "'Tzeltalan [tzel1253]'"              
[19] "'Tzeltal [tzel1254][tzh]-l-'"        
[20] "'Kanjobalan-Chujean [kanj1261]'"     
[21] "'Chujean [chuj1249]'"                
[22] "'Kanjobalan [kanj1262]'"             
[23] "'Kanjobal-Jacaltec [kanj1263]'"      
[24] "'Mocho [moch1257][mhc]-l-'"          
[25] "'Yucatecan [yuca1252]'"              
[26] "'Mopan-Itza [mopa1242]'"             
[27] "'Yucatec-Lacandon [yuca1253]'"       
[28] "'Lacandon [laca1243][lac]-l-'"       
[29] "'Huastecan Mayan [huas1241]'"

But some tip labels were badly converted:

R> mayan2$tip.label
 [1] "'Aguacateco [agua1252][agu]-l-'"            
 [2] "'Ixil [ixil1251][ixl]-l-'"                  
 [3] "'Mam [mamm1241][mam]-l-'"                   
 [4] "'Tektiteko [tekt1235][ttc]-l-'"             
 [5] "'Kaqchikel [kaqc1270][cak]-l-'"             
 [6] NA                                           
 [7] "'Achi [achi1256][acr]-l-'"                  
 [8] NA                                           
 [9] "'Sacapulteco [saca1238][quv]-l-'"           
[10] "'Sipacapense [sipa1247][qum]-l-'"           
[11] "'Kekchí [kekc1242][kek]-l-'"                
[12] "'Poqomam [poqo1253][poc]-l-'"               
[13] NA                                           
[14] "'Uspanteco [uspa1245][usp]-l-'"             
[15] "'Chol [chol1282][ctu]-l-'"                  
[16] "'Buena Vista Chontal [buen1245]'"           
[17] "'Miramar Chontal [mira1253]'"               
[18] "'Tamulté de las Sábanas Chontal [tamu1247]'"
[19] "'Cholti [chol1283]-l-'"                     
[20] "'Chortí [chor1273][caa]-l-'"                
[21] "'Epigraphic Mayan [epig1241][emy]-l-'"      
[22] "'Chanal Cancuc [chan1320]'"                 
[23] "'Tenango [tena1239]'"                       
[24] "'Tzotzil [tzot1259][tzo]-l-'"               
[25] "'Chuj [chuj1250][cac]-l-'"                  
[26] "'Tojolabal [tojo1241][toj]-l-'"             
[27] "'Akateko [west2635][knj]-l-'"               
[28] NA                                           
[29] NA                                           
[30] "'Motozintleco [moto1243]'"                  
[31] "'Tuzanteco [tuza1238]'"                     
[32] "'Itzá [itza1241][itz]-l-'"                  
[33] "'Mopán Maya [mopa1243][mop]-l-'"            
[34] "'Lacanjá [laca1244]'"                       
[35] "'Najá [naja1242]'"                          
[36] "'Yucatec Maya [yuca1254][yua]-l-'"          
[37] "'Chicomuceltec [chic1271][cob]-l-'"         
[38] "'Huastec [huas1242][hus]-l-'"

Apparently, too many consecutive single quotes...

Interesting... that's not what I'm getting. I do get what you get if I use phytools::read.newick() though.

I found a simpler tree to make my example for #48 , and if this isn't anyone else is struggling with perhaps it can be disregarded. I don't know what's happening at my machine though, but maybe... I don't know. Maybe it's not that important if I've found a workaround?

A colleague suggested that [.*?] are seen as comments by APEs parser.

Maybe you have an old version of ape?

Good point! I've got 5.5. Updating to 5.6-1 to see if it makes a difference. Otherwise maybe it's OS stuff?

Huh, doesn't seem like I can update to above 5.5. I've tried restarting R and Rstudio, but this is what I get

> update.packages("ape")
> .rs.restartR()
NULL

Restarting R session...

> packageVersion("ape")
[1] ‘5.5’

Maybe update outside RStudio?

What R version are you using? Maybe you need to update R first.

I'm running R 4.1.0 GUI 1.76 High Sierra build (7976)

Here's inside the R app itself

R version 4.1.0 (2021-05-18) -- "Camp Pontanezen"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin17.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

During startup - Warning messages:
1: Setting LC_CTYPE failed, using "C" 
2: Setting LC_COLLATE failed, using "C" 
3: Setting LC_TIME failed, using "C" 
4: Setting LC_MESSAGES failed, using "C" 
5: Setting LC_MONETARY failed, using "C" 
[R.app GUI 1.76 (7976) x86_64-apple-darwin17.0]

WARNING: You're using a non-UTF8 locale, therefore only ASCII characters will work.
Please read R for Mac OS X FAQ (see Help) section 9 and adjust your system preferences accordingly.
[History restored from /Users/skirgard/.Rapp.history]

> update.packages("ape")
--- Please select a CRAN mirror for use in this session ---
> packageVersion("ape")
[1] '5.5'

Can you install R packages from source? You could try installing the development version from github:

remotes::install_github("emmanuelparadis/ape")

This might not work as you might need to have installed some additional compilers on OS X.

Good idea @KlausVigo ! Unfortunately this was the result:


> remotes::install_github("emmanuelparadis/ape")
Downloading GitHub repo emmanuelparadis/ape@HEAD
These packages have more recent versions available.
It is recommended to update all of them.
Which would you like to update?

1: All                         
2: CRAN packages only          
3: None                        
4: Rcpp (1.0.7 -> 1.0.8) [CRAN]

Enter one or more numbers, or an empty line to skip updates: 1
Rcpp (1.0.7 -> 1.0.8) [CRAN]
Installing 1 packages: Rcpp
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.1/Rcpp_1.0.8.tgz'
Content type 'application/x-gzip' length 3281159 bytes (3.1 MB)
==================================================
downloaded 3.1 MB


The downloaded binary packages are in
	/var/folders/2r/drwc5p6n26ncm5cws9qsntrw0000gp/T//RtmpmWLdUy/downloaded_packages
✓  checking for file ‘/private/var/folders/2r/drwc5p6n26ncm5cws9qsntrw0000gp/T/RtmpmWLdUy/remotes8ba433af0c67/emmanuelparadis-ape-72ef75e/DESCRIPTION’ ...
─  preparing ‘ape’: (3.3s)
✓  checking DESCRIPTION meta-information ...
─  cleaning src
─  installing the package to process help pages (523ms)
         -----------------------------------
─  installing *source* package ‘ape’ ...
   ** using staged installation
   ** libs
   clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c BIONJ.c -o BIONJ.o
   clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c NNI.c -o NNI.o
   clang++ -mmacosx-version-min=10.13 -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c RcppExports.cpp -o RcppExports.o
   clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c SPR.c -o SPR.o
   clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c additive.c -o additive.o
   clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c ape.c -o ape.o
   clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c bNNI.c -o bNNI.o
   clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c bionjs.c -o bionjs.o
   clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c bipartition.c -o bipartition.o
   clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c bitsplits.c -o bitsplits.o
   clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c delta_plot.c -o delta_plot.o
   clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c dist_dna.c -o dist_dna.o
   clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c dist_nodes.c -o dist_nodes.o
   clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c ewLasso.c -o ewLasso.o
   clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c heap.c -o heap.o
   clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c mat_expo.c -o mat_expo.o
   clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c me.c -o me.o
   clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c me_balanced.c -o me_balanced.o
   clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c me_ols.c -o me_ols.o
   clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c mvr.c -o mvr.o
   clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c mvrs.c -o mvrs.o
   clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c nj.c -o nj.o
   clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c njs.c -o njs.o
   clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c pic.c -o pic.o
   clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c plot_phylo.c -o plot_phylo.o
   clang++ -mmacosx-version-min=10.13 -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c prop_part.cpp -o prop_part.o
   clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c rTrait.c -o rTrait.o
   clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c read_dna.c -o read_dna.o
   clang++ -mmacosx-version-min=10.13 -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c reorder_Rcpp.cpp -o reorder_Rcpp.o
   clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c reorder_phylo.c -o reorder_phylo.o
   clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c treePop.c -o treePop.o
   clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c tree_build.c -o tree_build.o
   clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c tree_phylo.c -o tree_phylo.o
   clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c triangMtd.c -o triangMtd.o
   clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c triangMtds.c -o triangMtds.o
   clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c ultrametric.c -o ultrametric.o
   clang++ -mmacosx-version-min=10.13 -std=gnu++14 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o ape.so BIONJ.o NNI.o RcppExports.o SPR.o additive.o ape.o bNNI.o bionjs.o bipartition.o bitsplits.o delta_plot.o dist_dna.o dist_nodes.o ewLasso.o heap.o mat_expo.o me.o me_balanced.o me_ols.o mvr.o mvrs.o nj.o njs.o pic.o plot_phylo.o prop_part.o rTrait.o read_dna.o reorder_Rcpp.o reorder_phylo.o treePop.o tree_build.o tree_phylo.o triangMtd.o triangMtds.o ultrametric.o -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
   ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0'
   ld: warning: directory not found for option '-L/usr/local/gfortran/lib'
   ld: library not found for -lgfortran
   clang: error: linker command failed with exit code 1 (use -v to see invocation)
   make: *** [ape.so] Error 1
   ERROR: compilation failed for package ‘ape’
─  removing ‘/private/var/folders/2r/drwc5p6n26ncm5cws9qsntrw0000gp/T/Rtmp6rb3Wv/Rinstaa764bb0a0c/ape’
         -----------------------------------
   ERROR: package installation failed
Error: Failed to install 'ape' from GitHub:
  System command 'R' failed, exit status: 1, stdout & stderr were printed
> 

Hi @HedvigS,
it seems you need to install gfortran (https://gcc.gnu.org/wiki/GFortranBinaries) and also have XCode installed, which seems the case.
Regards,
Klaus

Aaah! good point. Thanks for the help!

darn it, another xcode dependency.

That's sort of a bit of a deal-breaker if I'm fully honest. I collaborate with people in larger projects, if we have to go outside of R to install additional things it makes the workflow and reproducibility a lot more complicated.

Will this be the case for all ape versions from now on? any chance there might be an "apelite"-package which some of the basic functions but not the ones that require more complicated dependencies?

wait.. maybe this is a R 4.0.0 thing?

Hi @HedvigS,
you should be able to update ape to 5.6.1. I just spotted a small mistake in your code, when you tried to update.
Try using either install.packages("ape) or update.packages() and see if this works.
The arguments are not the same, so I am not quite sure what

> > update.packages("ape")

would do.

Regards,
Klaus

Thanks @KlausVigo , I appreciate your patience :)

That's so weird.. now it works :D :D !

> install.packages("ape")
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.1/ape_5.6-1.tgz'
Content type 'application/x-gzip' length 3631117 bytes (3.5 MB)
==================================================
downloaded 3.5 MB


The downloaded binary packages are in
	/var/folders/2r/drwc5p6n26ncm5cws9qsntrw0000gp/T//Rtmp3fZKEr/downloaded_packages
> package_version("ape")
Error: invalid version specification ‘ape’
> packageVersion("ape")
[1] ‘5.6.1’