nexml_read: Read NeXML files into various R formats

View source: R/nexml_read.R

nexml_readR Documentation

Read NeXML files into various R formats

Description

Read NeXML files into various R formats

Usage

nexml_read(x, ...)

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

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

## S3 method for class '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

# file
f <- system.file("examples", "trees.xml", package="RNeXML")
nexml_read(f)
## Not run:  # 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))

## End(Not run)

RNeXML documentation built on Feb. 16, 2023, 6:56 p.m.