From p.dalgaard at biostat.ku.dk  Sun Nov 21 22:39:02 2004
From: p.dalgaard at biostat.ku.dk (Peter Dalgaard)
Date: Sun Nov 21 22:41:08 2004
Subject: [Rd] TeXmacs and R 2.0.0
In-Reply-To: <1101066895.23405.46.camel@DreamGate>
References: <1101066895.23405.46.camel@DreamGate>
Message-ID: <x2653yq3ux.fsf@biostat.ku.dk>

"M. Edward Borasky" <znmeb@cesmail.net> writes:

> I have encountered an issue with TeXmacs and R 2.0.0, and I've found a
> somewhat unsatisfying workaround. My apologies if this is old news to
> the R-Devel list.

Funny you should chime in right now. I was just thinking of TeXmacs in
connection with ODS and the SAS/R discussion over on R-help.
 
> TeXmacs has the ability to start up an R session and copy the session
> input and output into a working document. The way it does this involves
> starting R and executing
> 
> > library(TeXmacs,lib.loc="/usr/share/TeXmacs/plugins/r/r/")
> 
> in the R session. The library was built with R 1.7.1, and hence will not
> work with R 2.0.0 or later.

<pedantic>
  That's a 
    <strong>
         PACKAGE
    </strong>
  !!
</pedantic>

This is of course the Wrong Way. The Right Way (or one of them) is to
provide a source package that can be installed using R CMD INSTALL on
whatever system the user has, and fixed up to meet the changing
requirements of the R installer (which are usually backwards
compatible). Even better, maintain said package at CRAN so that it
will be automatically checked against the current patch and
development versions and get built for devtool-challenged operating
systems.

> 
> The workaround is (as "root"):
> 
> 1. Edit
> 
>    /usr/share/TeXmacs/plugins/r/r/TeXmacs/DESCRIPTION
> 
> and remove the line at the bottom that starts with "Built:"
> 
> 2. Type
> 
>    R CMD build --force TeXmacs
> 
> 3. Type
> 
>    R CMD INSTALL -l `pwd` TeXmacs_0.1.tar.gz
> 
> My question is this: do I actually need to do the INSTALL, or is the
> build, followed by deleting the built package, enough? I've passed what
> I know so far on to the TeXmacs team; eventually they will incorporate
> some cleaner fix into their code, but I have no idea exactly how that
> will work, since they need to be able to work with older versions of R
> as well.

Yup, you'll need the INSTALL. The 'R CMD build' just creates a source
package based on the source directory, which you effectively
reverse-engineered out of the (in principle) binary install. But why
not '-l /usr/share/TeXmacs/plugins/r/r/'?

BTW, last I checked, the TeXmacs plugin did have a rather peculiar
habit of opening one R session and using that for all subsequent
access, no matter where they occurred in the text. This can have some
peculiar effects with a stateful system like R (using a variable
before it was calculated, redoing a calculation but not code that
depends on it further along in the text, etc.). Is this still so? A
more Sweave-like approach would be highly desirable.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907


[Rd] TeXmacs and R 2.0.0
Peter Dalgaard