Learn R Programming

Runiversal (version 1.0.2)

makexml: makexml

Description

This function converts an R object to xml code, so an output of an R script can be handled easly by any programming language. Every elements in xml is encapsulated in tags. Any variable in list or variable itself is placed between and tags. Values of elemenets are placed between and tags. Xml structure is easy to parse and browse.

Usage

makexml(obj, name = "")

Arguments

obj
R object that to be converted to xml.
name
Optinal. Each element in xml code is listed as . Default name is name of R object, but a new name can be defined.

Value

Returns a well-formed xml file for given R object.

Details

A generated output of lm object is like this:

0.662970909075238 -0.125473985248366 -0.0856149907633715 0.963352019137748 -0.212667731012814 -0.561977205893819 -0.133045701604119 -0.485339628713294 0.107354078697277 -0.624426907949804 1.45763471890252 -0.425268650800328 0.0858115975474794 -1.13967406760172 -0.313474791725809 -0.577239374729828 -0.0627629785631422 -0.329512013795331 0.348726585492226 -0.297509509277868 1.87009700945145 0.07273853162558 2 0.537496923826872 0.412022938578506 0.28654895333014 0.161074968081774 0.0356009828334077 -0.0898730024149584 -0.215346987663324 -0.340820972911691 -0.466294958160057 -0.591768943408423 0 1 8 lm, y ~ x ~, y, x

See Also

makejava

Examples

Run this code
x<-1:10
y<-rnorm(10)
ols<-summary(lm(y~x))
cat(makexml(ols))

Run the code above in your browser using DataLab