Learn R Programming

RFLPtools (version 2.0)

write.hclust: Cut a hierarchical cluster tree and write cluster identifiers to a text file.

Description

The tree obtained by a hierarchical cluster analysis is cut into groups by using cutree and the results are exported to a text file.

Usage

write.hclust(x, file, prefix, h = NULL, k = NULL, append = FALSE, dec = ",")

Arguments

x

object of class hclust: result of hierarchical cluster analysis computed via function hclust.

file

either a character string naming a file or a connection open for writing. "" indicates output to the console.

prefix

character. Information about the cluster analysis.

h

numeric scalar or vector with heights where the tree should be cut.

k

an integer scalar or vector with the desired number of groups.

append

logical. Only relevant if file is a character string. If TRUE, the output is appended to the file. If FALSE, any existing file of the name is destroyed.

dec

the string to use for decimal points in numeric or complex columns: must be a single character.

Details

The results are written to file by a call to write.table where the columns in the resulting file are seperated by tabulators (i.e. sep="\t") and no row names are exported (i.e. row.names = FALSE).

References

Flessa, F., Kehl, A., Kohl, M. Analysing diversity and community structures using PCR-RFLP: a new software application. Molecular Ecology Resources 2013 Jul; 13(4):726-33.

See Also

write.table, cutree

Examples

Run this code
# NOT RUN {
data(RFLPdata)
res <- RFLPdist(RFLPdata, nrBands = 4)
cl <- hclust(res)
# }
# NOT RUN {
write.hclust(cl, file = "Test.txt", prefix = "Bd4", h = 50)
# }
# NOT RUN {
res <- RFLPdist2(RFLPdata, nrBands = 4, nrMissing = 1)
cl <- hclust(res)
# }
# NOT RUN {
write.hclust(cl, file = "Test.txt", append = TRUE, prefix = "Bd4_Mis1", h = 60)
# }

Run the code above in your browser using DataLab