# NOT RUN {
fileName <- paste0(system.file(package = 'TreeTools'),
'/extdata/input/dataset.nex')
ReadCharacters(fileName)
fileName <- paste0(system.file(package = 'TreeTools'),
'/extdata/tests/continuous.nex')
continuous <- ReadCharacters(fileName)
# To convert from strings to numbers:
at <- attributes(continuous)
continuous <- suppressWarnings(as.numeric(continuous))
attributes(continuous) <- at
continuous
# Read a file with a known encoding that cannot be auto-detected by R
# Specify appropriate encoding:
fileEncoding <- "UTF-8"
# Open connection to file
con <- file(fileName, encoding = fileEncoding, open = "r")
ReadCharacters(con)
# Close connection after use
close(con)
# }
Run the code above in your browser using DataLab