Learn R Programming

StatDataML (version 1.0-27)

readSDML: Read StatDataML Files

Description

Read a StatDataML file and create a corresponding R object.

Usage

readSDML(file="", text=NULL, validate=FALSE, read.description=FALSE, ...)

Value

a data object with an additional SDMLdescription attribute

Arguments

file

the StatDataML file to be read.

text

a string containing StatDataML code (if no file is specified).

validate

logical, should file be validated using the DTD specified in file?

read.description

logical, should the description tag in file be read?

...

arguments passed to xmlTreeParse

Author

David.Meyer@R-Project.org

Details

For details on the StatDataML format see the proposal.

See Also

see also writeSDML

Examples

Run this code
library(XML)

TEST <-
    function(x) identical(readSDML(text = capture.output(writeSDML(x))), x)

# write/read vector with names
a <- 1:15
names(a) <- paste("n", 1:15, sep="")
stopifnot(TEST(a))

# write/read a matrix
A <- matrix(1:16, ncol=4)
rownames(A) <- paste("row", 1:4, sep="")
colnames(A) <- paste("col", 1:4, sep="")
stopifnot(TEST(A))

# write/read a data.frame
data(iris)
stopifnot(TEST(iris))

# write/read a ts object
data(airmiles)
stopifnot(TEST(airmiles))

# write/read the islands data
data(islands)
stopifnot(TEST(islands))

Run the code above in your browser using DataLab