16.04.2014 Views

Embedding R in Windows applications, and executing R remotely

Embedding R in Windows applications, and executing R remotely

Embedding R in Windows applications, and executing R remotely

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

R2HTML package<br />

formatt<strong>in</strong>g HTML output on the fly<br />

or by us<strong>in</strong>g a template scheme<br />

Eric Lecoutre<br />

Institut de statistique, Université catholique de Louva<strong>in</strong><br />

<br />

Abstract for the R User Conference, useR! 2004, Vienna<br />

We will present the R2HTML package. Basically, this package consists <strong>in</strong><br />

a set of functions similar to base pr<strong>in</strong>t or cat functions. Those functions<br />

allow to ”export” R objects to a web page, by writ<strong>in</strong>g the HTML tags, as flat<br />

text. Thus, it is possible to every R user to manage complex HTML reports,<br />

without any HTML knowledge.<br />

The package was <strong>in</strong>itially designed for teach<strong>in</strong>g purpose: the user may<br />

ask for an <strong>in</strong>teractive output, all comm<strong>and</strong>s bee<strong>in</strong>g automatically redirected<br />

to a HTML page. When us<strong>in</strong>g this functionnality, output are presented by us<strong>in</strong>g<br />

so called HTML frames, display<strong>in</strong>g both comm<strong>and</strong>s <strong>and</strong> their correspond<strong>in</strong>g<br />

output at the same time. Only graphs have to be explicitely exported<br />

by us<strong>in</strong>g the comm<strong>and</strong> HTMLplot(), as there is no way to know when the<br />

user want to <strong>in</strong>sert one graph (consider mak<strong>in</strong>g a graph <strong>and</strong> add<strong>in</strong>g l<strong>in</strong>es<br />

on it). At the end of a tra<strong>in</strong><strong>in</strong>g session, the student can take all the output<br />

with him - <strong>in</strong>clud<strong>in</strong>g graphs, exported as PNG og JPEG.<br />

We will also illustrate a way of us<strong>in</strong>g the package to create complex<br />

reports for statistical analysis, which look can easily be modified. For that,<br />

we will use a sample analysis that returns an object (a list with a custom<br />

class), create a function that exports this object by export<strong>in</strong>g it’s pieces<br />

with the functions provided by the package. Thus, analysis <strong>and</strong> report<strong>in</strong>g<br />

are separated. F<strong>in</strong>ally, we will demonstrate the power of CSS (Cascad<strong>in</strong>g<br />

Style Sheets) to also separate formatt<strong>in</strong>g <strong>in</strong>structions.<br />

Latest version of R2HTML package is available to download <strong>in</strong> CRAN <strong>and</strong><br />

comes with a vignette expla<strong>in</strong><strong>in</strong>g it’s uses.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!