Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/utils.xmlRead.R
This function controls the import of input data set.
1 | xmlRead.default(xmlItem)
|
xmlItem |
( |
Based on the tag name of the input data definition in the XML file, the corresponding
readXMLData_*
function is called, whereby *
is a placeholder for the data type
definition in the XML scheme. For example, for XML definitions following the data.frame
specification, a function readXMLData_data.frame <- function(xmlDataItem)
is expected,
which implements the XML parser for data.frame
s and returns the data as R object.
(data.frame
) or (variable
) or (vector
) or a named list of
all imported input datasets.
Matthias Pfeifer matthias.pfeifer@roche.com
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | data <- '<text type="character">My text is awesome</text>'
item <- XML::xmlRoot(XML::xmlParse(data,asText=TRUE))
value <- RTest::xmlRead.default(item)
stopifnot(value=="My text is awesome")
data <- '<list><data.frame><col-defs>
<coldef name="Column1" type="character"/>
<coldef name="Column2" type="numeric"/>
</col-defs>
<row name="1"><cell>ID1</cell><cell>1</cell></row>
<row name="2"><cell>ID2</cell><cell>2.1</cell></row>
<row name="3"><cell>ID3</cell><cell>3.1</cell></row>
</data.frame></list>'
item <- XML::xmlRoot(XML::xmlParse(data,asText=TRUE))
value <- RTest::xmlRead.default(item)
stopifnot(dim(value)[1]==3)
stopifnot(dim(value)[2]==2)
data <- '<variable type="character" value="My text is awesome"/>'
item <- XML::xmlRoot(XML::xmlParse(data,asText=TRUE))
value <- RTest::xmlRead.default(item)
stopifnot(value=="My text is awesome")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.