readSDML             package:StatDataML             R Documentation

_R_e_a_d _S_t_a_t_D_a_t_a_M_L _F_i_l_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     Read a StatDataML file and create a corresponding R object.

_U_s_a_g_e:

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

_A_r_g_u_m_e_n_t_s:

    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'

_D_e_t_a_i_l_s:

     For details on the 'StatDataML' format see the proposal.

_V_a_l_u_e:

     a data object with an additional 'SDMLdescription' attribute

_A_u_t_h_o_r(_s):

     David.Meyer@R-Project.org

_S_e_e _A_l_s_o:

     see also 'writeSDML'

_E_x_a_m_p_l_e_s:

     library(XML)

     # write/read vector with names
     a <- 1:15
     names(a) <- paste("n", 1:15, sep="")
     writeSDML(a, "testvec.xml")
     b <- readSDML("testvec.xml")
     cat(" a is equal b :", all.equal(a,b), "\n")

     # write/read a matrix
     A <- matrix(1:16, ncol=4)
     rownames(A) <- paste("row", 1:4, sep="")
     colnames(A) <- paste("col", 1:4, sep="")
     writeSDML(A, "testmat.sdml")
     B <- readSDML("testmat.sdml")
     cat(" A is equal B :", all.equal(A,B), "\n")

     # write/read a data.frame
     data(iris)
     writeSDML(iris, "iris.sdml")
     irisSDML <- readSDML("iris.sdml")
     cat(" iris is equal irisSDML: ", all.equal(iris,irisSDML), "\n")

     # write/read a ts object
     data(airmiles)
     writeSDML(airmiles, "air.sdml")
     airSDML <- readSDML("air.sdml")
     cat(" airmiles is equal airSDML: ", all.equal(airmiles,airSDML), "\n")

     # write/read the islands data
     data(islands)
     writeSDML(islands, "islands.sdml")
     islandsSDML <- readSDML("islands.sdml")
     cat(" islands is equal islandsSDML: ", all.equal(islands,islandsSDML), "\n")

