Learn R Programming

RNeXML (version 2.4.11)

nexml_read: Read NeXML files into various R formats

Description

Read NeXML files into various R formats

Usage

nexml_read(x, ...)

# S3 method for character nexml_read(x, ...)

# S3 method for XMLInternalDocument nexml_read(x, ...)

# S3 method for XMLInternalNode nexml_read(x, ...)

Arguments

x

Path to the file to be read in. An XML::XMLDocument-class or XMLNode-class

...

Further arguments passed on to xmlTreeParse

Examples

Run this code
# file
f <- system.file("examples", "trees.xml", package="RNeXML")
nexml_read(f)
if (FALSE)  # may take > 5 s
# url
url <- "https://raw.githubusercontent.com/ropensci/RNeXML/master/inst/examples/trees.xml"
nexml_read(url)
# character string of XML
str <- paste0(readLines(f), collapse = "")
nexml_read(str)
# XMLInternalDocument
library("httr")
library("XML")
x <- xmlParse(content(GET(url)))
nexml_read(x)
# XMLInternalNode
nexml_read(xmlRoot(x))

Run the code above in your browser using DataLab