Download STATWEAVE Users` Manual

Transcript
1
Introduction
S TAT W EAVE is an extension of some previous literate-programming packages (S WEAVE,
SAS WEAVE, and ODF W EAVE) for statistics. Its intent is to provide portable software that
can integrate code and documentation for a large variety of statistical (and nonstatistical)
languages and file formats, and also to provide for extensibility so that a user can add
more file formats and languages.
S TAT W EAVE is written in Java, providing easy portability across platforms. As currently implemented, S TAT W EAVE has only a command-line interface, but a graphical interface could be easily added. A Java virtual machine (JVM) is already installed on most
people’s systems, and the decision to use Java also separates S TAT W EAVE from requiring
the user to have any particular one of the statistical packages it supports.
In its current implementation, the supported languages include R, SAS, Stata, S-Plus,
Maple, LATEX, DOS, and UNIX; and more can easily be added. The currently supported file
formats are .tex (using an extension of S WEAVE’s LATEX syntax) and .odt (the Open Document Format XML specification currently implemented in OpenOffice). The probable
next developments for file formats would be Word 2007’s .docx format, and extending
the .tex format to support S WEAVE’s noweb syntax.
To use S TAT W EAVE, one prepares a source file in the same basic format as the intended output file. Computer code is added to this file, and marked in some way so that
S TAT W EAVE can tell that it is code in a certain language. These marked blocks of code are
called “code chunks.” Processing via S TAT W EAVE involves extracting and running the
code chunks in the appropriate program(s), and creating an output document that contains all the materials in the source file, but embedding the code listings, output listings,
and any graphics produced in place of the code chunks. S TAT W EAVE figures out which
programs it needs to run, and runs them in order of first appearance in the source file.
Section 2 outlines how to install S TAT W EAVE on your system. Section 3 explains how
to run S TAT W EAVE from the command line, and the command-line options that are available. In Section 4, we describe how to prepare a source file for S TAT W EAVE. Section 5
details the various options that can be specified in the source file for controlling how the
code chunks are processed and displayed. S TAT W EAVE uses a configuration file that defines defaults for processing, specifies what languages are supported, provides paths to
these languages’ implementations on the local machine, etc. Section 7 explains the construction of this file. Finally, S TAT W EAVE is designed to be extensible, and a separate
document1 describes the Java class structure and how various interfaces can be implemented and configured to add support for new languages or file formats.
2
Installing S TAT W EAVE
All necessary components of S TAT W EAVE are provided in a single file, statweave.jar.
This is a Java archive file.2
1 This
manual is forthcoming
2 Because it has the same format as a ZIP archive, it is possible that your web browser will want to unpack
it. Don’t let that happen: keep it as a JAR file.
2