Hi Ryan.
How about using the attached wrapper? It just takes the file produced by
write.nexus.data & substitutes "DNA" for "STANDARD". The input data x
for type standard should be a matrix in which row names are species/OTU
names.
All the best, Liam
Liam J. Revell, Assistant Professor of Biology
University of Massachusetts Boston
web: http://faculty.umb.edu/liam.revell/
email: [email protected]
blog: http://blog.phytools.org
On 4/15/2014 4:05 PM, Ryan Felice wrote:
Is there an existing function in any R package that would allow me to save
a data frame of binary character data and format the datatype as
"STANDARD"? As far as I can tell, write.nexus.data in [ape] will only write
in "DNA" or "PROTEIN".
Ryan Felice
PhD Candidate
Ohio University Department of Biological Sciences
107 Irvine Hall
Athens, OH 45701
www.rnfelice.com
[email protected]
(201)981-8642
[[alternative HTML version deleted]]
_______________________________________________
R-sig-phylo mailing list - [email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/[email protected]/
writeNexusData<-function(x, file, format = "dna", ...){
if(format=="dna"||format=="DNA") write.nexus.data(x,file,format,...)
else if(format=="protein"||format=="PROTEIN")
write.nexus.data(x,file,format,...)
else if(format=="standard"||format=="STANDARD"){
X<-vector(mode="list",length=nrow(x))
for(i in 1:nrow(x)) X[[i]]<-x[i,]
names(X)<-rownames(x)
write.nexus.data(X,file,format="dna",...)
ff<-readLines(file)
ff<-gsub("DNA","STANDARD",ff)
write(ff,file)
}
}_______________________________________________
R-sig-phylo mailing list - [email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/[email protected]/