Hi, I am looking to import .nexus file in R to analyze it but am facing errors in the import step itself. I tried the following commands and obtained the following error messages.

```
> file<-read.nexus("hominoid.nex")
Error in start:end : NA/NaN argument
```

```
>tree<-read.tree("hominoid_apriori.tre")
Error in if (tp[3] != "") obj$node.label <- tp[3] : 
  missing value where TRUE/FALSE needed
```

```
> file2<-read.nexus("testmodel.nex")
Error in X[sb] <- gsub(".*\\]", "", X[sb]) : 
  NAs are not allowed in subscripted assignments
In addition: Warning messages:
1: In grep("\\[", X) : input string 26 is invalid in this locale
2: In grep("\\[", X) : input string 231 is invalid in this locale
3: In grep("\\]", X) : input string 26 is invalid in this locale
4: In grep("\\]", X) : input string 231 is invalid in this locale
5: In LEFT == RIGHT :
  longer object length is not a multiple of shorter object length
```

The file link,

https://www.dropbox.com/sh/kqo8bwi9s7ispcx/AADDEsRuDfLCpKbZeGgU81nha?dl=0

I will be glad to provide necessary details, kindly advice.

PS: I am able to read the file using `read.csv` command but not able to perform any operations with it.

BR, M
In ape, `read.nexus()` reads in a treefile formatted in NEXUS format. `read.tree()` reads a treefile formatted in Newick (or parenthetical) format.

You want `read.nexus.data(file=hominoid.nex)` for the data and `read.nexus("hominoid_apriori.tre")`.

`testmodel.nex` is just a PAUP* block and not a properly formatted NEXUS data file. This is appended to a NEXUS data file and then executed. If you want to do model selection, may I suggest Minin et al.'s decision-theroetic approach, [DT-ModSel][1]? Append the block, execute the NEXUS file, then run the perl script.

Please respond if things aren't working.

 [1]: http://www.webpages.uidaho.edu/~jacks/DTModSel.html