A
Size: a a a
A
a
library(xml2)
as_xml_document(list(foo = list(
bar = structure(list("s"), id = "a"),
bar = structure(list(1), id = "b"))))
{xml_document}
<foo>
[1] <bar id="a">s</bar>
[2] <bar id="b">1</bar>
PU
a
PU
a
PU
a
<Mazda_RX4 mpg = 21 cyl = 6 disp = 160 hp = 110 drat = 3.9/>
PU
a
PU
a
tree <- xml_new_root("cars")
tree %>%
xml_add_child(.value = "car") %>%
xml_add_child(.value = "mpg", rownames(mtcars)[1]) %>%
xml_add_sibling(.value = "mpg", 21) %>%
xml_add_sibling(.value = "cyl", 6)
tree
{xml_document}
<cars>
[1] <car>\n <mpg>Mazda RX4</mpg>\n <mpg>21</mpg>\n <cyl>6</cyl>\n</car>
АК
tree <- xml_new_root("cars")
tree %>%
xml_add_child(.value = "car") %>%
xml_add_child(.value = "mpg", rownames(mtcars)[1]) %>%
xml_add_sibling(.value = "mpg", 21) %>%
xml_add_sibling(.value = "cyl", 6)
tree
{xml_document}
<cars>
[1] <car>\n <mpg>Mazda RX4</mpg>\n <mpg>21</mpg>\n <cyl>6</cyl>\n</car>
<tbl>
<row>
<col1>value</col1>
<col2>value</col2>
</row>
</tbl>
a
<tbl>
<row>
<col1>value</col1>
<col2>value</col2>
</row>
</tbl>
a
apply(mtcars, 1, as.list)
), если сделать вот так:as_xml_document(list(apply(mtcars, 1, as.list)))
C
PU
C
C
АК