s-news
[Top] [All Lists]

Re: [S] Variations on literate programming

To: Frank E Harrell Jr <fharrell@virginia.edu>
Subject: Re: [S] Variations on literate programming
From: rossini@biostat.washington.edu (A.J. Rossini)
Date: 24 Feb 2000 11:13:17 -0800
Cc: s-news@wubios.wustl.edu
In-reply-to: Frank E Harrell Jr's message of "Thu, 24 Feb 2000 10:51:41 -0800"
References: <38B5A7ED.C80C7712@virginia.edu>
Sender: owner-s-news@wubios.wustl.edu
User-agent: Gnus/5.0803 (Gnus v5.8.3) XEmacs/21.1 (Bryce Canyon)

Vince Carey (Harvard) was working on it; I don't know what the status
of his work is, it's been 5+ years...

I'm working on it for ESS, as well; but don't hold your breath unless
I get some funding support.  I need to clean up the "forward" side
first, before getting the "back-into" side taken care of!  (and more
importantly, release the corrections for Splus 5.1 that have been
sitting around for 2 weeks, waiting to be packaged up).

best,
-tony

-- 
A.J. Rossini                   Research Assistant Professor of Biostatistics 
Biostatistics/Univ. of Washington  (Th) Box 357232   206-543-1044 (3286=fax)
Center for AIDS Research/HMC/UW   (M/F) Box 359931   206-731-3647 (3693=fax)
VTN/SCHARP/FHCRC                 (Tu/W) Box 358080   206-667-7025 (4812=fax)
rossini@(biostat.washington.edu|u.washington.edu|hivnet.fhcrc.org)
http://www.biostat.washington.edu/~rossini



>>>>> "FEH" == Frank E Harrell <fharrell@virginia.edu> writes:

    FEH> Literate programming, in which programs are embedded in full
    FEH> documentation (LaTeX, html, etc.) and extractors pull out
    FEH> either the code (to run through a compiler) or text markup,
    FEH> seems to have a lot of advantages.  I am interested in a
    FEH> different angle in which S-Plus programs do computations that
    FEH> are inserted into documents.  As I see it, literate
    FEH> programming utilities do not allow for program output to be
    FEH> incorporated semi- automatically into the document.

    FEH> Here is a simple LaTeX example where S-Plus calculates a
    FEH> chi-square statistic and a P-value for inserting into a
    FEH> table.  Here I assume that LaTeX variables are named the same
    FEH> as S-Plus variables, and the names contain only letters, so
    FEH> that code can be simplified using a little function.  This
    FEH> function can also convert NAs to blanks.

    FEH> lvar <- function(x, digits=2)
    FEH>  paste('\\def\\',substitute(x),'{',
    FEH>           ifelse(is.na(x),'',round(x,digits)),'}', sep='')

    FEH> cat(lvar(chisq), lvar(pval,4), sep='\n', file='parms.tex')

    FEH> The contents of parms.tex will look like the following:

    FEH> \def\chisq{3.84} \def\pval{0.05}

    FEH> Inside the main LaTeX source use:

    FEH> \input{parms} \begin{tabular}{l|cc} \hline\hline Test &
    FEH> $\chi^2$ & $P$--value \\ \hline Age effect & \chisq & \pval
    FEH> \\ \hline \end{tabular}

    FEH> Has anyone seen are more systematic and general approach to
    FEH> this sort of problem?  I would especially like for
    FEH> statistical reports to have calculated values inserted (as
    FEH> above) but also able to link better with the code that
    FEH> generated the calculations, so the report can be somewhat
    FEH> self-documenting and easier to maintain over time.

    FEH> -- Frank E Harrell Jr Professor of Biostatistics and
    FEH> Statistics Division of Biostatistics and Epidemiology
    FEH> Department of Health Evaluation Sciences University of
    FEH> Virginia School of Medicine
    FEH> http://hesweb1.med.virginia.edu/biostat


    FEH> -----------------------------------------------------------------------
    FEH> This message was distributed by s-news@wubios.wustl.edu.  To
    FEH> unsubscribe send e-mail to s-news-request@wubios.wustl.edu
    FEH> with the BODY of the message: unsubscribe s-news

-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

<Prev in Thread] Current Thread [Next in Thread>