Re: [R] Sweave bug? when writing figures / deleting variable in chunk

2007-06-28 Thread Friedrich Leisch
 On Thu, 28 Jun 2007 08:14:44 -0400,
 D G Rossiter (DGR) wrote:

   Thanks to the four distinguished R'ers who answered. I have used  
   Sweave intensively for over a year, and have poured through all the  
   doc. as well as the help archives, and could find nothing on this. It  
   is now well known to me! since it bit me, but it did cost me a day  
   of head-scratching and putting it in the shortest possible form for  
   the list (the original example where this happened was a lot more  
   complicated).

Sorry!

   Perhaps it could be documented in Sweave- 
   manual-20060104.pdf or its successor?

Yes, I'll put it in ASAP.

Best,
Fritz

-- 
---
Prof. Dr. Friedrich Leisch 

Institut für Statistik  Tel: (+49 89) 2180 3165
Ludwig-Maximilians-Universität  Fax: (+49 89) 2180 5308
Ludwigstraße 33
D-80539 München http://www.stat.uni-muenchen.de/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to extract R codes that embedded in a HTML file

2007-05-18 Thread Friedrich Leisch

    Original Message 
   Subject: Re: [R] How to extract R codes that embedded in a HTML file 
   using   Stangle?
   Date: Thu, 17 May 2007 17:01:30 +
   From: Tao Shi [EMAIL PROTECTED]
   To: [EMAIL PROTECTED], [EMAIL PROTECTED]
   CC: r-help@stat.math.ethz.ch

   : [EMAIL PROTECTED]

   Hi Uwe,

   Thanks for the answer, but I still need a bit more clearification.  I 
   always
   thought that a .rnw or .snw file is a file mixing word processing markup
   (e.g. tex or HTML) and R/S code using noweb syntax.  Is the reason for
   'Stangle' is not working with .rnw file with HTML due to there is no proper
   driver available (like RweaveHTML driver for Sweave)?  If yes, does R2HTML
   package have plans to provide a such driver?

   Tao


The following does the trick for me:

R mytangle - function ()
  list(setup = RtangleSetup, runcode = utils:::RtangleRuncode,
   writedoc = RtangleWritedoc,
   finish = utils:::RtangleFinish, checkopts = RweaveHTMLOptions)

R Stangle(/PATH/TO/R/SITE-LIBRARY/R2HTML/samples/example1.snw,
   driver=mytangle)
Writing to file example1.R


Best,
Fritz

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Issues with Sweave and inclusion of graphics from nlme

2007-04-27 Thread Friedrich Leisch
 On Fri, 27 Apr 2007 07:15:22 -0400,
 Duncan Murdoch (DM) wrote:

   On 4/27/2007 5:39 AM, [EMAIL PROTECTED] wrote:
   Dear all,
   I'm using the nlme package. I would like to introduce the plot of my
   groupedData object in my latex report using Sweave but it doesn't work. 
   I have no error message in R (Sweave(my.file_Rnw)) and the plot is
   generated in R, but when I want to see the pdf (I'm using TexnicCenter) of
   my report, there is an error message and no pdf file is generated. It seems
   that the plot generated by plot.nmGroupedData is not found by TexnicCenter.
   Does anyone have an idea on how to solve this problem?

   If the dot in the filename is real, I'd guess that's your problem. To 
   confirm, take a look at the .tex file produced by Sweave.  Find the line 
   corresponding to this figure.  It will be an \includegraphics call, 
   something like

   \includegraphics{my.file_Rnw-fig}

   Your TeX is probably interpreting this as the file my.file_Rnw-fig 
   rather than automatically adding the .pdf file extension, because it 
   thinks you've specified the extension to be file_Rnw-fig.

Another reason could be that many nlme plots are using lattice, see

  http://www.ci.tuwien.ac.at/~leisch/Sweave/FAQ.html#x1-9000A.7

Best,

-- 
---
Prof. Dr. Friedrich Leisch 

Institut für Statistik  Tel: (+49 89) 2180 3165
Ludwig-Maximilians-Universität  Fax: (+49 89) 2180 5308
Ludwigstraße 33
D-80539 München http://www.stat.uni-muenchen.de/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Sweave question: prevent expansion of unevaluated reused code chunk

2007-03-14 Thread Friedrich Leisch
 On Wed, 14 Mar 2007 10:39:43 -0500,
 Kevin R Coombes (KRC) wrote:

   Hi,
   I don't know of a standard way to indicate this; I would have suggested

   combined,expand=FALSE

   (with expand=TRUE the default), except for the fact that Seth Falcon 
   already suggested the same notation in his response...so I can only 
   second the motion.


Sounds like a good idea. Currently this is not possible, but it
shouldn't be too hard to add the feature.

Best,
Fritz

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Sweave, Xfig, pdflatex and \setkeys

2006-12-14 Thread Friedrich Leisch
 On Wed, 13 Dec 2006 12:38:04 +0100,
 David Lindelöf (DL) wrote:

   On Tue, 2006-12-12 at 13:22 -0500, Kevin E. Thorpe wrote:
Trouble is that Sweave defines (with \setkeys) the default width of
\includegraphics to be 0.8 times the \textwidth. The result is that the
graphic is scaled, but not the text.

I was looking for a way to temporarily undefine the default width of
included graphics, but without success. Does anyone know how to undo a
definition that has been set with \setkeys?

   If you knew what setting you needed, you could try
   
   \setkeys{Gin}{width=whatever}
   
   before your include, and set it back to the default afterward with
   
   \setkeys{Gin}{width=0.8\textwidth}

   Yes, but the trouble is that for arbitrary figures created with Xfig I
   cannot know what the correct width is going to be. And I could not find
   any help on how to undefine variables set with \setkeys.

Yes, I should document Sweave.sty much better ...

  \usepackage[nogin]{Sweave}

in your .Rnw file will do the trick, i.e., not set any Gin keys.

HTH,
Fritz

-- 
---
Prof. Dr. Friedrich Leisch 

Institut für Statistik  Tel: (+49 89) 2180 3165
Ludwig-Maximilians-Universität  Fax: (+49 89) 2180 5308
Ludwigstraße 33
D-80539 München http://www.stat.uni-muenchen.de/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Sweave, R and complex latex projects

2006-10-16 Thread Friedrich Leisch
 On Sat, 14 Oct 2006 23:00:27 +0100,
 Mark Wardle (MW) wrote:

   Hello all,
   I've been able to use R very successfully to run simple statistics and
   generate the plots I require.

   I've been evaluating Sweave, and have hit upon a small problem that I
   don't seem to be able to workaround. Sweave runs very well for single
   file latex documents, but I have a complex thesis made up of several
   parts and chapters. These are arranged with a master latex file and
   subdirectories with \include-ed latex fragments representing those
   parts/chapters, and I don't seem to be able to get Sweave to work properly.

   I've tried a number of approaches, including converting the master
   document into a Snw file itself, or even generating chapters manually
   chapter by chapter using Sweave and then \includeing the result into
   the master tex file. Unfortunately for the latter attempt, the the latex
   generated doesn't prepend the required path to the filename, and so
   latex looks for the pdfs and tex files in the wrong place - it looks in
   the root directory (where the master tex file is located) rather than
   the chapter subdirectory where all the files have been generated.

   I hope I'm not missing something obviously documented, but I can't see
   it in the Sweave docs. Is there an option to prepend a pathname to the
   filename of Sweave generated TeX and PDF documents?

Yes, simply set prefix.string to a path, not only a filename. E.g.,

\SweaveOpts{prefix.string=figs/myfile}

will place all figures in subdir figs (you have to create the
directory first manually) and call the separate files myfile-XXX
where XXX is number or name of the chunk.

   Do people use Sweave for complex multi-file latex projects, and what is
   the best approach? I'm almost tempted to keep R and Latex separate, and
   continue to run a R script to generate all of the dynamic tables/charts
   which are then \inputed, but I was rather attracted to the whole
   Sweave approach.

I personally mostly use Makefiles as suggested by Deepayan.

In addition there is \SweaveInput{} which works similar to Latex's own
\input{} command. There currently is no equivalent of \include{}.

HTH,
Fritz

-- 
---
Prof. Dr. Friedrich Leisch 

Institut für Statistik  Tel: (+49 89) 2180 3165
Ludwig-Maximilians-Universität  Fax: (+49 89) 2180 5308
Ludwigstraße 33
D-80539 München http://www.stat.uni-muenchen.de/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Sweave, R and complex latex projects

2006-10-16 Thread Friedrich Leisch
 On Sat, 14 Oct 2006 16:04:50 -0700,
 Deepayan Sarkar (DS) wrote:



   %.tex: %.Rnw
   echo library(tools); Sweave('$') | ${R_PROG} --vanilla --silent

Note that we now have R CMD Sweave (new in R 2.4.0) for this purpose.



Best,
Fritz

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Sweave and the [ function

2006-09-05 Thread Friedrich Leisch
 On Tue, 05 Sep 2006 20:56:33 +1000,
 Ross Darnell (RD) wrote:

   Hi Vincent
   This would seem logical but in this case doesn't work.
   It doesn't seem to be a Sweave problem (feature) at all  but within R as 
   Hadley stated.

Yes, Sweave parses  deparses the code in oreder to make full
expressions out of lines of text, i.e., to know where open
parentheses are closed etc. This is necessary in order to know where
to insert output when multiple lines are contained in one code chunk,
but unfortunately looses the original formatting as has correctly been
explained earlier in this thread.

Best,
Fritz

-- 
---
Prof. Dr. Friedrich Leisch 

Institut für Statistik  Tel: (+49 89) 2180 3165
Ludwig-Maximilians-Universität  Fax: (+49 89) 2180 5308
Ludwigstraße 33
D-80539 München http://www.stat.uni-muenchen.de/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] issues with Sweave and inclusion of graphics in a document

2006-08-26 Thread Friedrich Leisch
 On Fri, 25 Aug 2006 11:05:48 -0700 (PDT),
 Thomas Harte (TH) wrote:

   --- Prof Brian Ripley [EMAIL PROTECTED] wrote:
   savePlot is just an internal version of dev.copy, part of the support for 
   the menus on the windows() graphics device.
   
   It is described in `An Introduction to R' (the most basic R manual).

   the most basic R manual doesn't quite answer my question. 

   by itself, dev.copy doesn't copy the width and height of the device whereas 
savePlot
   copies whatever is displayed on the screen giving me 
what-you-see-is-what-you-save
   capabilities (but only under the Windows OS). 

   i can get pretty close to this in linux by writing a function to save the
   plot to a pdf device:
   label=first.ar.1, results=hide=
   # no savePlot in Linux ... so write my own function
   savePlotAsPdf- function(pdfname, from=dev.cur()) {
   from- from
   pdf(pdfname, width=width, height=height)
   to- dev.cur()
   dev.set(from)
   dev.copy(which=to)
   dev.off()
   }
   # a long AR process is best viewed in a wide window ... 
   # width  height are now variables
   width- 20; height- 5
   x11(width=width, height=height)
   sp- make.ar.1(alpha=.5, n=800)
   plot(sp, type=l, col=blue)
   # width  height via dynamic scoping in savePlotAsPdf
   savePlotAsPdf(ar.pdf)
   @

Umm, maybe I don't get your point, but in what way does the complicated
code above do anythingdifferent from

**

results=hide=
sp- make.ar.1(alpha=.5, n=800)
@

ar,fig=true,width=20,height=5,include=false=
plot(sp, type=l, col=blue)
@

\begin{figure}
  \includegraphics[width=14.5cm]{myprefix-ar}
\end{figure}

**

???

Best,

-- 
---
Prof. Dr. Friedrich Leisch 

Institut für Statistik  Tel: (+49 89) 2180 3165
Ludwig-Maximilians-Universität  Fax: (+49 89) 2180 5308
Ludwigstraße 33
D-80539 München http://www.stat.uni-muenchen.de/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] issues with Sweave and inclusion of graphics in a document

2006-08-26 Thread Friedrich Leisch
 On Sat, 26 Aug 2006 05:38:58 -0700 (PDT),
 Thomas Harte (TH) wrote:


   hallo, friedrich, and thanks for your reply.

   if i Stangle your code i get:

   sp- make.ar.1(alpha=.5, n=800)
   plot(sp, type=l, col=blue)

   whereas if i Stangle my code, i get:

   width- 20; height- 5
   x11(width=width, height=height)
   sp- make.ar.1(alpha=.5, n=800)
   plot(sp, type=l, col=blue)
   savePlotAsPdf(ar.pdf)

   this, i think, is the problem in a nutshell.

   i want my R code to look like this because i (often) want to open
   a separate device (for example, to have specific dimensions as
   above) and i may wish to save its contents. on the other hand, i
   may not wish to save a device's contents: i may wish to open
   several devices for comparison purposes and i may wish to save
   only certain devices, in keeping with the Sweave options
   echo=false and results=hide.

   if i use your, admittedly uncomplicated, code chunk, then i am
   limited to seeing the output in the final document. i can't cut
   and paste the code chunk into an R session and see the results as
   i wish to see them before saving.

   currently for each project i work on, i usually end up with a very
   lengthy .R file with all the code (and embedded mathematical
   annotation in LaTeX), and then i have to write a set of notes or a
   report in LaTeX duplicating or expanding on the mathematics. i'm
   hoping to supplant this, rather inefficient, method with a single
   .Rnw file and the use of Sweave. this, i believe, is what Sweave
   was designed to do. but i do wish to write my R code (warts and
   all) the way that i want to in the .Rnw file and only include the
   output (graphics or text) of certain parts of that code in the
   document. i hope that seems reasonable.

   perhaps i was not clear, or succinct enough, in my original post
   (i tried to get the point across by providing example .Rnw files,
   but i'm aware that it's asking a lot to wade through a lengthy
   example to retrieve a point).

OK, no I think I understand what you want: running the *tangled* code
should open windows with the same height/width ratio as in the Latex
document, right? Your first posting suggested to me more the other way
round ...

No, what you want is currently not directly possible with Sweave, you
will have to use workarounds like the one you posted. You can even
easily write your own tangle function doing it automatically (Rtangle
is really trivial can be easily adjusted to ones personal needs).

Best,
Fritz

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Sweave and multipage lattice

2006-07-20 Thread Friedrich Leisch
 On Wed, 19 Jul 2006 11:01:02 -0500,
 Sundar Dorai-Raj (SD) wrote:

   Dieter Menne wrote:
   Dear R-Listeners,
   
   as the Sweave faq says:
   
   http://www.ci.tuwien.ac.at/~leisch/Sweave/FAQ.html
   
   creating several figures from one figure chunk does not work, and for
   standard graphics, a workaround is given. Now I have a multipage trellis
   plot with an a-priori unknown number of pages, and I don't see an elegant
   way of dividing it up into multiple pdf-files.
   
   I noted there is a page event handler in the ... parameters, which would
   provide a handle to open/close the file.
   
   Any good idea would be appreciated.
   
   Dieter
   

   Hi, Dieter,

   I haven't seen a reply to this and I don't know Sweave. However, will 
   the following example work? It does require you know the layout for one 
   page.

   --sundar

   library(lattice)

   trellis.device(postscript, file = barley%02d.eps,
   width = 5, height = 3, onefile = FALSE,
   paper = special)
   ## from ?xyplot
   dotplot(variety ~ yield | site, data = barley, groups = year,
key = simpleKey(levels(barley$year), space = right),
xlab = Barley Yield (bushels/acre) ,
aspect=0.5, layout = c(1, 1), ylab=NULL)
   dev.off()

   files - list.files(pattern = glob2rx(barley*.eps))
   for(file in files)
  cat(\\includegraphics{, file, }\n\n, sep=)

Yes, doing the above embedded in a chunk with results=tex should do
the trick. You may need to enclose the call to dotplot() in print()
though.

Best,
Fritz

-- 
---
Prof. Dr. Friedrich Leisch 

Institut für Statistik  Tel: (+49 89) 2180 3165
Ludwig-Maximilians-Universität  Fax: (+49 89) 2180 5308
Ludwigstraße 33
D-80539 München http://www.stat.uni-muenchen.de/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] cclust causes R to crash when using manhattan kmeans

2006-04-07 Thread Friedrich . Leisch
 On Fri, 07 Apr 2006 09:02:46 +0200,
 Timo Becker (TB) wrote:

   Dear R users,
   When I run the following code, R crashes:

   require(cclust)
   x - matrix(c(0,0,0,1.5,1,-1), ncol=2, byrow=TRUE)
   cclust(x, centers=x[2:3,], dist=manhattan, method=kmeans)

   While this works:

   cclust(x, centers=x[2:3,], dist=euclidean, method=kmeans)

   I'm posting this here because I am not sure if it is a bug.
   I've been searching for a manhattan kmeans method and I found a solution 
   by using the package amap:

   require(amap)
   Kmeans(x, x[2:3,], method=manhattan)

   This works for me, so I don't need the cclust package anymore.
   Anyway, I wanted to report the cclust behaviour.

   R version 2.2.1, 2005-12-20, i386-pc-mingw32



Thanks, this is indeed a bug, and has not been noticed yet because it
seems to apply only for very small data sets like your example, for
larger data sets it seems to works fine:

R require(cclust)
Loading required package: cclust
[1] TRUE
R x=matrix(rnorm(100), ncol=2)
R cclust(x, centers=x[2:3,], dist=manhattan, method=kmeans)

Clustering on Training Set


Number of Clusters:  2
Sizes  of Clusters:  33 17

Algorithm converged after 4 iterations.
Changes: 12 3 1 1


2 side notes:

* cclust is no longer actively maintained, the code has been
  integrated in my more general package flexclust, see also
  http://www.ci.tuwien.ac.at/~leisch/papers/Leisch-2006.pdf
  (but cclust in flexclust has the same bug, so thanks a lot for
  reporting it).

* r-help is not really the correct place to report bugs, please try to
  contact the package maintainer first, or use r-devel (but only if
  the maintainer does not respond to a direct email). This is not
  because we want to hide bugs from the public, but simply to reduce
  traffic on the lists.

Best,
Fritz

-- 
---
Prof. Dr. Friedrich Leisch 

Institut für Statistik  Tel: (+49 89) 2180 3165
Ludwig-Maximilians-Universität  Fax: (+49 89) 2180 5308
Ludwigstraße 33
D-80539 München  http://www.ci.tuwien.ac.at/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] partitioning cluster function

2006-04-07 Thread Friedrich . Leisch
 On Wed, 5 Apr 2006 12:58:00 -0700,
 Linda Lei (LL) wrote:

   Hi All,
   For the function bclust(e1071), the argument base.method is
   explained as must be the name of a partitioning cluster function
   returning a list with the same components as the return value of
   'kmeans'.

 

   In my understanding, there are three partitioning cluster functions in
   R, which are clara, pam, fanny. Then I check each of them to see which
   of them can get same components as the return value of kmeans, by
   using the following codes:

 

The functions in the cluster package will not work, because they have
different interface (names of arguments and return values). cclust
from the package of the same name can be used together with kmeans,
but note that that is no longer actively maintained (see my email to
r-help from a few minutes ago).

Best,
Fritz

-- 
---
Prof. Dr. Friedrich Leisch 

Institut für Statistik  Tel: (+49 89) 2180 3165
Ludwig-Maximilians-Universität  Fax: (+49 89) 2180 5308
Ludwigstraße 33
D-80539 München  http://www.ci.tuwien.ac.at/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] about clustering method

2006-02-28 Thread Friedrich . Leisch
 On Mon, 27 Feb 2006 11:09:24 -0800,
 Linda Lei (LL) wrote:

   Hi there,
   I'm doing some clustering analysis and try to find all the algorithms
   related to clustering in R. Here is the list of the algorithms I found.
   But I'm not sure if 

   It's the complete list.  Could you please check it and see if there're
   other ones? 

You may want to have a look at the CTAN Task View about Clustering at

http://cran.r-project.org/src/contrib/Views/

HTH,
Fritz Leisch

-- 
---
Friedrich Leisch 

Institut für StatistikTel: +49 89 2180 3165
Ludwig-Maximilians-UniversitätFax: +49 89 2180 5308
Akademiestraße 1
D-80799 München  http://www.ci.tuwien.ac.at/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Question about Sweave

2006-02-28 Thread Friedrich . Leisch
 On Mon, 27 Feb 2006 11:34:00 -0800,
 Elizabeth Purdom (EP) wrote:

   Hi,
   I'm not sure if Sweave questions should go to the general list, but it 
   seems to be part of the core R package without a separate maintainer.

   I am writing a tutorial for R in a latex file. I'd like to use Sweave, 
   since this seems its ideal usage. The problem is that I want to 
   purposefully put errors in and then the output that comes with it in the 
   text of my tutorial. However the errors kill the function Sweave() in R 
   when what I would like is for Sweave to just run it and include the error 
   message as part of the output.

   I have set options(error=NULL). It doesn't seem that the error options 
   would affect Sweave in the right way, since an error in my .Rnw file causes 
   an error in Sweave() itself, not just in the processing of the code, but 
   maybe there's an error-handling system I don't know about that would do it. 
   (I tried error=expression(NULL) but Sweave couldn't finish regardless). I 
   don't see any options in the documentation of Sweave that allow this 
   behavior, either.

There is no direct support, but fortunately R is a full-featured
programming language ;-)

I usually do something along the lines of

**

\documentclass[a4paper]{article}

\begin{document}

errchunk,eval=false=
x=sin(a)
echo=false=
cat(try({
errchunk
}))
@ 

\end{document}

**

which of course only helps if you know where the error will happen,
but in your application this seems to be the case.

Best,
Fritz Leisch

-- 
---
Friedrich Leisch 

Institut für Statistik  Tel: (+49 89) 2180 3165
Ludwig-Maximilians-Universität  Fax: (+49 89) 2180 5308
Akademiestraße 1
D-80799 München  http://www.ci.tuwien.ac.at/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Sweave, mle and curve

2006-02-13 Thread Friedrich . Leisch
 On Mon, 13 Feb 2006 11:16:14 +0100,
 Göran Broström (GB) wrote:

   I am trying to write a lesson on maximum likelihood with Sweave. I get
   a surprising result with the following code, lec4.Snw:

   \documentclass[a4paper,12pt]{article}
   \usepackage[latin1]{inputenc}

   \title{Maximum likelihood}

   \author{Göran Broström}

   \begin{document}

   \maketitle

   fig=TRUE=
   ## Simulate Y:
   n - 25
   Y - sum(rpois(n, lambda = 1))
   Y
## Define minusloglik:
   minusloglik - function(theta) n * theta - Y  * log(theta)
   curve(minusloglik, 0.2, 2, xlab = theta)

   library(stats4)
   cat(Y is now , Y, \n)
   fit - mle(minusloglik, start = list(theta = Y/n))
   summary(fit)
   @

   \end{document}

   In R, I get:

   Sweave(lec4.Snw)
   Writing to file lec4.tex
   Processing code chunks ...
1 : echo term verbatim eps pdf
   Y is now  27
   Y is now  24

   You can now run LaTeX on 'lec4.tex'
   

   and the latex document will have two different mle's,  one in the
   figure, and another one from 'mle'.  One uses Y = 27 and the other Y =
   24!

   I can save the situation by moving Y - ... to a separaye code chunk.
   Does 'fig=TRUE' imply that the code chunk is run twice?

Yes, once to get all textual output, and then once for each graphics
format requested.

Best,

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Sweave: skip if figure exists

2006-01-23 Thread Friedrich . Leisch
 On Mon, 23 Jan 2006 16:41:09 +0100,
 Dieter Menne (DM) wrote:

   Dear RWeavers,
   to speed up report generation with Sweave, I am looking for an option
   skipifexists for figures. A named figure chunk should not be executed if
   the file to be produced already exists.

   I know that this could be done with hooks, but I want to avoid to re-invent
   this wheel.

I have plans to implement something like this for a very long time
now, but no code yet. Contributions are of course more than welcome.

Best,

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Downloads -- possible bug?

2006-01-20 Thread Friedrich . Leisch
 On Thu, 19 Jan 2006 18:55:03 +0100,
 Uwe Ligges (UL) wrote:

   Elizabeth Purdom wrote:
   Hi,
   When I go to the CRAN page to download a new version of R, there are not 
   the same versions available depending on which mirror I pick. When I go to 
   http://cran.cnr.berkeley.edu/, for example, I get 2.2.1, but if I go 
   http://cran.stat.ucla.edu/ the option is 2.2.0 (I'm downloading the 
Windows 
   base file). Neither refreshing nor clearing my cache changes it. For 
future 
   reference, I'd like to know if this is a mistake or if different mirrors 
   are just updated at different times?

   Looks like http://cran.stat.ucla.edu/ has not been synced for a couple 
   of months, since Kurt Hornik's *daily* check has the date 08-Oct-2005 on 
   that mirror. Fritz?

Yes, I will contact the admins.

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Bookmarking a page inside r-project.org

2006-01-03 Thread Friedrich . Leisch
 On Tue, 3 Jan 2006 07:29:27 +,
 hadley wickham (hw) wrote:

   A solution would be a content-management system that produced the HTML
   of the site from some other form of input.  Only the output HTML would
   need to be mirrored.  Care to put together such a thing, and import all
   the existing pages into it?

   One way to get around the offline problem is to have a dynamic copy
   somewhere and then spider and save it (eg. with wget -r).  This would
   (obviously) require a server somewhere - but with a post-commit svn
   hook could be kept up to date easily.  However, it is still difficult
   to view changes to the page immediately.

   What assumptions can I make about what tools are available to the
   editors?  Can I assume the standard unix tool chain?

Yes.

   What
   assumptions can I make about the people doing the editing?  How many
   people edit the pages?

For www.R-project.org all of R core have write access, but only a few
actually do it ;-)

   How familiar with html are they?

Hard to tell, let's assume at least basic familiarity with HTML (but
very good familiarity to the concept of markup laguages per se).

   You say many
   of the pages are manually edited, which ones aren't?

Under www.r-project.org I think all are manual.

   How are they
   generated?

on CRAN all package listings are of course auto-generated (mostly
using perl scripts), the mirror list is created using R.

   Are all the pages under
   https://svn.r-project.org/R-project-web/trunk/ ?


No, CRAN is not, as it is pulled together from various sites where
maintainers of binary distributions etc. create their parts - the
CRAN master itself is mirror for the pits and pieces (e.g., windows
R base binaries are mirrored from Duncan Murdoch, windows packages
from Uwe Ligges, etc. etc.).

Best,

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Sweave: How can I include S input in paragraph mode

2005-12-02 Thread Friedrich . Leisch
 On Fri, 02 Dec 2005 10:38:21 +1000,
 Ross Darnell (RD) wrote:

   Sweavers
   As the title suggests I would appreciate any help to include S code in
   ordinary paragraph mode. I can use the textsl font but is isn't the
   same.

You can always renew the Sinput and Soutput environments to whatever
you like. Sweave.sty provides a default setting, but you are free to
modify them as you like. E.g., for slides I redefine them such that
input and output have different colors.

HTH,

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] R Hierarchical clustering leaf node

2005-12-02 Thread Friedrich . Leisch
 On Thu, 01 Dec 2005 11:34:01 -0600,
 Qunfeng  (Q) wrote:

   Hello,
   I am new to the R package. After I use R to perform the hierarchical 
   clustering,  I am only interested in retrieving the leaf nodes that share 
   the last common ancestors. As illustrated below, I'd like to retrieve (B, 
   C) as a cluster and then (D, E) as another cluster.Any chance to do 
   this in R?  Thanks! BTW, I just subscribed to this list (not sure if the 
   subscription is succeeded), please copy your anser to my personal email 
   ([EMAIL PROTECTED]) -- Qunfeng

Knowing what the internal structure of an hclust object is makes it
actually quite easy for groups of two (getting triplets or higher
would require a little bit more code):

As an example we can use

R set.seed(1)
R x=rnorm(5)
R h=hclust(dist(x))
R str(as.dendrogram(h))
--[dendrogram w/ 2 branches and 5 members at h = 2.43]
  |--leaf 4
  `--[dendrogram w/ 2 branches and 4 members at h = 1.17]
 |--[dendrogram w/ 2 branches and 2 members at h = 0.146]
 |  |--leaf 2
 |  `--leaf 5
 `--[dendrogram w/ 2 branches and 2 members at h = 0.209]
|--leaf 1
`--leaf 3

The key is the merge element of the reurn object, from that cou can
extract the two pairs by

R -h$merge[apply(h$merge,1,function(x) all(x0)),]

 [,1] [,2]
[1,]25
[2,]13

HTH,

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] SWeave - can I see output in the source?

2005-11-20 Thread Friedrich . Leisch
 On Sat, 19 Nov 2005 09:52:22 -0500,
 Duncan Murdoch (DM) wrote:

   On 11/19/2005 6:13 AM, [EMAIL PROTECTED] wrote:
   On Fri, 18 Nov 2005 13:49:36 -0500,
   Duncan Murdoch (DM) wrote:
   
   
I'm working on a Latex document with lots of R code in it, so naturally 
enough it would be a good idea to use SWeave.  But then I don't get to 
see the output as I'm editing.
   
Or do I?  Is there a tool to process a .Rnw file and incorporate the 
output from the commands into it (in a form that is not used for 
producing the output .tex file, but which is updated each time I process 
the file)?
   
   I'm not sure if I understand the question correctly, but if you edit
   Sweave files in Emacs using ESS you can send the code lines to a
   running R process, and there you see the output. At least that's how I
   write my Sweave files.
   
   When I want to see all at once I typically do a tangle  source.

   That's bad news for me, because I'm allergic to Emacs.

Well, the origin of Sweave is that I found Tony Rossini's ESS-noweb
mode for Emacs really neat and started to explre what you can do with
it ...


   What I had in 
   mind was this:  In my .Rnw file, I enter:

   echo=true=
   1:3
   @

   Then I pass it to some tool, which modifies the .Rnw file, changing it 
   to something like

   echo=true=
   1:3
   @
   %  1:3
   % [1] 1 2 3

   (My editor will notice that the tool has changed the file and offer to 
   load the new version at this point.  I think that's a reasonably common 
   editor option.)

   Then I can see what I'm writing about when I describe the results.  If I 
   later come along and edit the source to change it to

   echo=true=
   1:4
   @
   %  1:3
   % [1] 1 2 3

   then the next time I run the file through the tool it will delete the 
   stale output and modify my file to look like this:

   echo=true=
   1:4
   @
   %  1:4
   % [1] 1 2 3 4

Shouldn't be too hard to code (apart from the fact that you cannot
insert figures as easily as text), but I personally am unlikely to do
it because it is completely orthogonal to my style of interacting with
Sweave documents. When I edit them I always want them to be connected
to a running R process to easily try out modifications etc.

Ad emacs vs other editors: well, we just would need another editor
that is connected to a running R process, i.e., can easily send code
lines to R, and there are a couple of those. Emacs will know when you
are in a code chunk and when you are in a doc chunk, and lets you
execute code only in those cases (including sending all of the current
chunk to R). It also does syntax highlighting (R vs LaTeX) in
dependence on the 

But if the user knows when to press the corresponding button a simple
solution might be to simply turn of the R connection for LaTeX files
in another editor than Emacs. 



   Besides the advantage that I had in mind (being able to see the output 
   as I'm editing, and being confident that it will match the output in the 
   final document), this will mean that I'll have a versionable record of 
   what the output looked like (so I'll be alerted to changes in it caused 
   by updates to R or some package I'm using).  I could get this by saving 
   the .tex output, but to me this seems preferable.  But I don't have a 
   lot of experience with SWeave yet, so maybe there's a better workflow.


That is something I have alraqdy thought a little bit about, i.e., to
have mechanisms for easily comparing the processed versions of Sweave
files and see if something has changed. The tricky bit are (as always
with regression tests) the figures, and I have no simple solution for
that yet. Started playing with Paul's GraphicsQC package, but found no
time for serious coding yet.

Without checking figures a simple diff on the .tex files so far worked
fine for me ...


Best,
Fritz

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] SWeave - can I see output in the source?

2005-11-19 Thread Friedrich . Leisch
 On Fri, 18 Nov 2005 13:49:36 -0500,
 Duncan Murdoch (DM) wrote:

   I'm working on a Latex document with lots of R code in it, so naturally 
   enough it would be a good idea to use SWeave.  But then I don't get to 
   see the output as I'm editing.

   Or do I?  Is there a tool to process a .Rnw file and incorporate the 
   output from the commands into it (in a form that is not used for 
   producing the output .tex file, but which is updated each time I process 
   the file)?

I'm not sure if I understand the question correctly, but if you edit
Sweave files in Emacs using ESS you can send the code lines to a
running R process, and there you see the output. At least that's how I
write my Sweave files.

When I want to see all at once I typically do a tangle  source.

Best,
Fritz

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Sweave (R?) font encoding problems

2005-10-31 Thread Friedrich . Leisch
 On Mon, 31 Oct 2005 16:46:24 +0100,
 Luís Torgo (LT) wrote:

   Dear R list,
   I'm having some problems with font encodings when using R+Sweave+Latex in 
my 
   native language: Portuguese.

   My environment:
   Kubuntu 5.10 Linux
   $ uname -a
   Linux nassa 2.6.12-9-686 #1 Mon Oct 10 13:25:32 BST 2005 i686 GNU/Linux

  R R.version
_
   platform i486-pc-linux-gnu
   arch i486 
   os   linux-gnu
   system   i486, linux-gnu  
   status
   major2
   minor1.1  
   year 2005 
   month06   
   day  20   
   language R  
  R Sys.getlocale()
   [1] 
   
LC_CTYPE=pt_PT.utf-8;LC_NUMERIC=C;LC_TIME=pt_PT.utf-8;LC_COLLATE=pt_PT.utf-8;LC_MONETARY=pt_PT.utf-8;LC_MESSAGES=pt_PT.utf-8;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C
  R localeToCharset()
   [1] ISO8859-1


   Here is a small example trying to replicate my problems:

   File:exp.Rnw
   
   \documentclass[10pt,twoside]{article}
   \usepackage[dvips]{graphicx}
   \usepackage[portuges]{babel}
   \usepackage[latin1]{inputenc}
   \usepackage[T1]{fontenc}

You use a UTF-8 locale but load latin1 input encoding in latex - that
cannot work.

Try

\usepackage[utf8]{inputenc}

and no special fontenc setting - works for me for Austrian German.

HTH,

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] setkeys and Sweave

2005-09-16 Thread Friedrich . Leisch
 On Fri, 16 Sep 2005 10:38:51 +0200,
 Christian Hoffmann (CH) wrote:

   Hi there:
   Using

   \setkeys{Gin}{width=1.0\textwidth}
   \setkeys{Gin}{height=10cm}
   \setkeys{Gin}{height=0.8\textwidth}

   all seem to work under R-2.1.1 under sparc, solaris2.9, but

   \setkeys{Gin}{scale=0.3}
   \setkeys{Gin}{angle=90}

   do not work. I have not been able to find relevant information, googling 
   on setkeys proved confusing, at best.

   http://cnlart.web.cern.ch/cnlart/218/node85.html states:
   ---
 Setting key values globally

   If you want to specify a global value for a set of keys, then you can 
   use the \setkeys command defined in the keyval package (described below).

   As an example let us consider the case where you would like your figure 
   to be scaled to the width of the line. Then you could specify the following:

  \setkeys{Gin}{width=\linewidth}

   The first argument Gin of the \setkeys command refers to the 
   \includegraphics command. The result will be that all images include 
   with this command (when the graphicx is loaded) will be set to the 
   desired width inside the current group or environment.

   In the similar way one could specify any of the possible arguments of 
   the \rotatebox command by using the Grot specifier, e.g.,

  \setkeys{Grot}{origin=tc}
   ---

   Question:

   Which variants of \setkeys are there? Is there a list stating these?


That's not really an R question, but a LaTeX question. Maybe you have
more luck on a LaTeX list. I always use the grfguide.ps manual that
comes with the graphics package (at least on my Debian Luinux box) as
reference, or the LaTeX companion. 


   Can several \setkeys{of the same sort} be used inside one document?

Yes, I regularly do that. Every \setkeys{} sets the value from the
point in the LaTeX document where it appears, i.e.,

\setkeys{Gin}{width=1.0\textwidth}

fig1

\setkeys{Gin}{width=0.5\textwidth}

fig2


does the expected.

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Long lines with Sweave

2005-09-15 Thread Friedrich . Leisch
 On Thu, 15 Sep 2005 09:35:25 +0200,
 Martin Maechler (MM) wrote:

 Jan == Jan T Kim [EMAIL PROTECTED]
 on Wed, 14 Sep 2005 14:46:20 +0100 writes:

  Jan On Wed, Sep 14, 2005 at 02:49:56PM +0200, Henrik Andersson wrote:
   Jan T. Kim wrote:
On Wed, Sep 14, 2005 at 10:14:59AM +0200, Henrik Andersson wrote:

   I have used Sweave a lot the latest year, but never really used any 
long 
   function calls.
   
   
   If I have code which look like this
   
   -
   gof - benthic.flux(ID=Gulf of Finland,
meas.conc=conc,
bw.conc=bw.conc,
time=times,
substance=expression(DIC~(mmol~m^{-3}))
)
   -
   
   I get the output by Sweave in my pdf file, like this:
   
   ---
 gof - benthic.flux(ID = Gulf of Finland, meas.conc = conc,
   + bw.conc = bw.conc, time = times, substance = expression(DIC ~
   + (mmol ~ m^{
   + -3
   + })))
   
   
   I can understand that it will not look exactly as entered but why is 
the 
   '-3' on a line of it's own?
   
   Can anyone suggest a idea to how I can make this more readable.


It seems you've been thinking LaTeX rather than R ;-)  :
The exponent -3 in the expression should be enclosed by parentheses
rather than by curly braces.

The code formatting done by the print method inserts the newline after
{ and before }.

Best regards, Jan
   
   If you look at demo(plotmath), I get the impression that m^(-3) does not 
   give me the desired behavior.
   
   I want to have -3 in superscript without visible parentheses.
   
   Tricky!

  Jan Ok, I see.

  Jan It seems to me that you could omit the curly braces in the example, I
  Jan don't see any differences between the title in the plots produced by

  Jan plot(1:10, main = expression(DIC~(mmol~m^-3)))

  Jan and

  Jan plot(1:10, main = expression(DIC~(mmol~m^{-3})))

  Jan For more complex exponents, you could try plain() to prevent them from
  Jan being wrongly grouped by operator precedence, as in

  Jan plot(1:10, main = expression(DIC~(mmol~m^plain(-3 + t

   neat idea, but

  Jan Not exactly ideal for readability, however...

   indeed.  And really only a workaround:

   You shouldn't have to uglify your R code in order to work around
   Sweave pecularities.


Hmm, it's not really an Sweave peculiarity, but one of the R
parser. After saving Henrik's code in file test.R I get

R x  = parse(test.R)
R x
expression(gof - benthic.flux(ID = Gulf of Finland, meas.conc = conc, 
bw.conc = bw.conc, time = times, substance = expression(DIC ~ 
(mmol ~ m^{
-3
}
R deparse(x)
[1] expression(gof - benthic.flux(ID = \Gulf of Finland\, meas.conc = conc, 

[2] bw.conc = bw.conc, time = times, substance = expression(DIC ~ 
 
[3] (mmol ~ m^{   
 
[4] -3
 
[5] }

and the latter is used by Sweave. The code chunks need to be parsed,
because otherwise there is no way how to know where to insert
output. A source(..., echo=TRUE) will suffer from the same problem.

Best,
Fritz

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Setting width in batch mode

2005-09-09 Thread Friedrich . Leisch
 On Thu, 8 Sep 2005 15:01:23 -0400 (EDT),
 Jonathan Dushoff (JD) wrote:

   As instructed, I have spent a long time searching the web for an answer
   to this question.

   I am trying to use Sweave to produce lecture slides, and have the
   problem that I can't control the formatting of my R source.  Setting
   options(width), as recommended in this forum, works fine on the R
   _output_, but seems to have unpredictable effects on the echoing of the
   source code.

   If I try setting options(width) directly in R, I note that it has _no_
   effect on echoed source code, whereas Sweave does sometimes break source
   code, but not predictably, and not to the same width as output code.

   I would be happy with any method of manually or automatically
   controlling the line width of Sweave source, using R, Sweave or LaTeX
   options.  Making the font smaller does not count, though; I want to
   break the lines.

   Any help is appreciated.

   An example of Sweave input and output is appended.

   The last break is right, while the others are too late.

The deparser of R only *tries* to break lines at the given cutoff
(Sweave uses 0.75*getOption(width) for input lines), so you
soemtimes have to play a little bit, and yes, results are somewhat
unpredictable. After storing your code in file ex1.R I get:

R expr=parse(ex1.R)
R length(expr)
[1] 5

R for(n in 1:length(expr)) print(deparse(expr[[n]], width.cutoff=.75*55))
[1] options(width = 55)
[1] data(state)
[1] data.frame(area = mean(state.area), pop = mean(state.pop), 
[2] hop = mean(state.area))
[1] c(medianarea = median(state.area), medianpop = median(state.pop))
[1] c(medianarea = median(median(state.area)), 
[2] medianpop = median(state.pop)) 

R for(n in 1:length(expr)) print(deparse(expr[[n]], width.cutoff=.75*45))
[1] options(width = 55)
[1] data(state)
[1] data.frame(area = mean(state.area),   
[2] pop = mean(state.pop), hop = mean(state.area))
[1] c(medianarea = median(state.area), 
[2] medianpop = median(state.pop)) 
[1] c(medianarea = median(median(state.area)), 
[2] medianpop = median(state.pop)) 


I know that's not exactly the answer you were looking for, but that's
the way it is. I'll add a sentence or two to the FAQ.

Best,

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] how to read individual values from a pixmap object

2005-08-04 Thread Friedrich . Leisch
 On Thu, 4 Aug 2005 18:02:55 +1000,
 Tony Gill (TG) wrote:

[...]

   Now I would like to read individual pixel values and store them in a
   separate vector. However I have not found a straight-forward way to do this.
 
   I thought that something like:
 
   x - xGrey[1,1]
 
   would return the pixel value, but it seems to return a pixmap object with
   dimension 1x1 (i.e. only one pixel in size)
 
   xGrey[1,1]
   Pixmap image
 Type  : pixmapGrey 
 Size  : 1x1 
 Resolution: 1x1 
 Bounding box  : 1 0 2 1
 
   Any ideas on how to get the actual pixel value from a pixmap? (Note I could
   output to an ascii file and then read the file back in as text - but not
   nice!)


getChannels(xGrey) will get you the matrix of pixel values.

HTH,

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] LyX and Sweave

2005-07-27 Thread Friedrich . Leisch
 On Mon, 25 Jul 2005 14:12:41 +0200,
 Gorjanc Gregor (GG) wrote:

   Hello R-users!
   I have tried to use Sweave within LyX* and found two ways to accomplish
   this. I have attached LyX source file for both ways as well as generated 
   PDFs.

I have copied Gregor's files at

http://www.ci.tuwien.ac.at/~leisch/Sweave/LyX

for those who didn't get the attachments. LyX looks actually much
better and stable then when I last had a look a couple of years ago.

To add to the discussion: One might even get better integration
between Sweave and LyX because LyX allows specification of file
converters:

Edit-Preferences-Converters
Edit-Preferences-File Formats

After registering .Stex as a file format for Sweave I can import .Stex
files using conversion command

reLyX -f $$i  mv $$i.lyx $$o

and the move is necessary only because reLyX produces foo.Stex.lyx
rather then foo.lyx.

Using an Sweave shell script like Gregor's in combination with
lyx -e latex might do the trick to have direct conversion to PDF
from the LyX GUI.

Best,
Fritz

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] LyX and Sweave

2005-07-27 Thread Friedrich . Leisch

 On Wed, 27 Jul 2005 15:28:54 +0200,
 Gorjanc Gregor (GG) wrote:

[...]

   Nope. That's what I also thought, but I was really amaized when discovered 
that
   there is no need for this. You only need to set up noweb stuff as mentioned 
at

   http://thread.gmane.org/gmane.editors.lyx.general/18847

   and use article(noweb) for document style. Then everything (export and view 
   directly from LyX GUI) just works. As I said I was really surprised with 
it. 
   Try with SweaveNoweb.lyx and you will see. This way, one can skip my silly
   Sweave.sh ;)

Ahh, now I get it. Still it needs some polishing, because after
configuring LyX that way regular noweb will no longer work, but it
shouldn't take too much of an effort to duplicate the noweb configs in
LyX to recognise Sweave.

That certainly looks like the way to go, might give Sweave another
strong push because people do no longer have to learn all of LaTeX ...

If we make a clean solution then I think it shouldn't be too hard to
convince the LyX guys to include it in their distribution - that
would make an out-of-the-box solution.

But it certainly looks very promising.

Best,
Fritz

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Sweave with layout() and loop

2005-06-27 Thread Friedrich . Leisch
 On Sun, 26 Jun 2005 11:36:14 -0700 (PDT),
 Mikkel Grum (MG) wrote:

   When I try the following code with the Windows
   graphics window, a new window is opened for each
   multiple of four images I produce.

   par(layout(matrix(c(1,2,3,4), 2, 2, byrow = TRUE)),
   mar = c(2, 3, 2, 3))

   for (i in 1:n) {
image(... )
}

   When I try to do the same with Sweave to produce a pdf
   document, I only get one graphic with the first four
   graphs.  How do I get the rest when n is greater than
   four?

   Plots, fig=TRUE, eps=FALSE, echo=FALSE,   
   results=hide, width=6.8, height=9.8=

   par(layout(matrix(c(1,2,3,4), 2, 2, byrow = TRUE)),
   mar = c(2, 3, 2, 3))

   for (i in 1:n) {
image(... )
}

   Any ideas?

FAQ A.8:

A.8  Creating several figures from one figure chunk does not work

Consider that you want to create several graphs in a loop similar to

fig=TRUE  
for (i in 1:4) plot(rnorm(100)+i)  
@

This will currently not work, because Sweave allows only one graph per
figure chunk. The simple reason is that Sweave opens a postscript
device before executing the code and closes it afterwards. If you need
to plot in a loop, you have to program it along the lines of

results=tex,echo=FALSE=  
for(i in 1:4){  
file=paste(myfile, i, .eps, sep=)  
postscript(file=file, paper=special, width=6, height=6)  
plot(rnorm(100)+i)  
dev.off()  
cat(\\includegraphics{, file, }\n\n, sep=)  
}  
@

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] mlbench xor

2005-06-17 Thread Friedrich . Leisch
 On Fri, 17 Jun 2005 13:28:21 +0200,
 Thorstensen Nicolas (TN) wrote:

   HI!
   I have 2D feature vectors and 2 classes. I want to solve this 
   classification problem with SVM. I create an object XOR of the mlbench 
   library.
   Then I replace the values of the XOR object with my values. Then I do a 
   plot and I have my data plotted and coloured with the labels from the 
   XOR object. So I replace the class labels
   in the xor object with my class labels. But when I do a plot with the 
   new class labels every object is coloured in one colour. But half of the 
   points should be in different colour(because different class label). As 
   well when I apply svm on the xor object with th replaced data it finds 
   just one class.

It is not the purpose of the r-help mailing list that undergraduate
students ask questions about their classwork. We have a lab session
scheduled for next Wednesday where you can ask questions like this in
person. 

My apologies to the list for the noise that has been generated.

Best,
Fritz Leisch

-- 
---
Friedrich Leisch 
Institut fr Statistik Tel: (+43 1) 58801 10715
Technische Universitt WienFax: (+43 1) 58801 10798
Wiedner Hauptstrae 8-10/1071
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Hclust question

2005-06-03 Thread Friedrich . Leisch
 On Fri, 03 Jun 2005 12:22:52 -0400,
 Mike Schuler (MS) wrote:

   Hey,
   I am running hclust on several different distance matrices and I have a 
   question thats more about labeling. I've been looking for a way to label 
   the edge values on the graph with their distances between them. I've 
   been looking through the documentation and I haven't found anything yet. 
   Anyone know if there is a way to plot 'hclust' graphs with such edge 
   values? Or convert it to another type that can have its edge values labeled?

   And to clarify what I mean by edge values, I have two pictures 
   describing what I mean. First, 
   http://clavius.bc.edu/~schulerm/images/test.gif [3.8k] is what I 
   currently have. What I'm looking for is something similar to this: 
   http://clavius.bc.edu/~schulerm/images/test2.gif [5.1k]. I arbitrarily 
   put in values on the edges with the Gimp but I'm looking for some way to 
   do that on my plots of 'hclust'.

help(dendrogram)
example(dendrogram)

should give you a start.

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] input line length in Sweave

2005-05-25 Thread Friedrich . Leisch
 On Tue, 24 May 2005 16:23:31 -0400 (GMT-04:00),
 Woodrow Setzer (WS) wrote:

   I am having trouble in Sweave with input line lengths.  For example, I may 
have in my input file the chunk

[...]

   Is there a way to get Sweave to wrap long input lines better, or
   get it to use my own formatting of the input?  I realize I can
   edit the output tex file, but that is impractical in my
   application (too many).

   I am using R version 2.0.1 Patched (2005-01-26) on a Linux system
   (so, I suppose one possible answer is that this is fixed in 2.1.0;
   I cannot switch right now).

No, no changes in 2.1 with respect to that problem. I have plans for a
solution for this problem, but won't have time for it before summer
break - in 2.2 there should be a fix for it.

Best,
Fritz

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Sweave and paths

2005-05-19 Thread Friedrich . Leisch
 On Tue, 17 May 2005 14:31:53 -0400,
 Bill Rising (BR) wrote:

   Is there some way to encourage \SweaveInput{foo} to find foo in a  
   subdirectory of a file tree?

Sure: Write some code doing it ;-)

   Something along the lines of the  
   behavior of list.files(stuff, recursive=TRUE). This would be very  
   helpful at calling small modular files, such as solution sets and the  
   like.

   I couldn't see anything in the documentation, and I looked in the  
   source code, but it seems that SweaveReadFiledoc() wants to look only  
   in the directory which contains foo.

Well, if you know where it is you can always use the path in the
\SweaveInput{} statement, i.e.,

\SweaveInput{foo/bar}

works for me.

Best,

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Avoiding Sweave formula cut's?

2005-05-04 Thread Friedrich . Leisch
 On Wed, 04 May 2005 13:40:18 +0200,
 christian schulz (cs) wrote:

   Hi,
   anybody know a possibilities how i could avoid less nicely  cut's  in 
   function calls with sweave  like:

   randomForest(x = RELSHIP ~ ., data = R_RELSHIP[splitR_RELSHIP ==  1, 
   ], importance = T, n(*here is the cut in the pdf*)
tree = 1000, na.action = na.omit)

   Until now i add expost linebreaks in the *.tex file, but with dozend of 
   models it might be painfuel for my hands.

Currently there is no way of doing this, because the code you see is
the result of a parse() and deparse() and I need the parse() step to
know where to insert output, i.e., where expressions are complete. I
have ideas about chunks where the code is exactly as in the source
file, but no time to implement them yet.

what you always can do is to write the code in a separate source file,
include that with, e.g., latex's listings package and do a source() on
it with echo=FALSE. If you want code and output mixed one needs to
parse() - you loose the original formatting.

.f

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] pstoedit

2005-04-14 Thread Friedrich . Leisch
 On Wed, 13 Apr 2005 09:36:21 +0100 (BST),
 (Ted Harding) ((H) wrote:

   On 13-Apr-05 Prof Brian Ripley wrote:
   On Wed, 13 Apr 2005, BORGULYA [iso-8859-2] Gábor wrote:
   
   Has onyone experience with pstoedit
   (http://www.pstoedit.net/pstoedit)
   to convert eps graphs generated by R on Linux to Windows
   formats (WMF or EMF)? Does this way work? Is there an other,
   better way?
   
   You can only do that using pstoedit on Windows.
   ^^

   Well, I have pstoedit on Linux and with

 pstoedit -f emf infile.eps outfile.emf

   I get what is claimed to be Enhanced Windows metafile
   and which can be imported into Word (though then it is
   subsequently somewhat resistant to editing operations,
   such as rotating if it's the wrong way up).

I always use

pstoedit -f xfig $1 $figfile
fig2dev -L emf $figfile $outfile

on Linux (Debian's pstoedit seems not to support emf). Doesn't work
for all graphics, but in most cases it does, and when it works I get
something I can fully edit in Word, i.e., I can change the text of
axis labels, move points etc.

HTH,
Fritz

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] R Package: mmlcr and/or flexmix

2005-04-12 Thread Friedrich . Leisch
 On Tue, 12 Apr 2005 00:44:17 -0400,
 Geller, Scott (IHG) (GS() wrote:

   Greetings 
   I'm a relatively new R user and I'm trying to build a latent class model.
   I've used the 'R Site Search' and it appears there's not much dialogue on
   these packages

[...]


   libray(flexmix)

   m1-flexmix(nts ~ first_brand_HOLIDAY+ perc_zone1+ perc_Group_nights+
   perc_num_asian+  DaysBetweenStays+ CROStays+ DaysSinceLastStay+
   wghtmean_median_age_pop100+ perc_num_white+ perc_num_hispanic+
   perc_CROStays+ numMonthsActive+ WEBStays+ property_loyalty+ perc_NoZone+
   rho+ PCR_Dummy_class+ ltgold1+ ltgold3+ p_hat_PCR, data = data, k = 2, model
   = FLXglm(family = poisson))

   rm1-refit(m1)

   summary(rm1)

 

[ Scott sent me in private a subset of the data ]

For me this seems to work fine:

R set.seed(123)
R m1-flexmix(nts ~ first_brand_HOLIDAY+ perc_zone1+ perc_Group_nights+
+ perc_num_asian+  DaysBetweenStays+ CROStays+ DaysSinceLastStay+
+ wghtmean_median_age_pop100+ perc_num_white+ perc_num_hispanic+
+ perc_CROStays+ numMonthsActive+ WEBStays+ property_loyalty+ perc_NoZone+
+ rho+ PCR_Dummy_class+ ltgold1+ ltgold3+ p_hat_PCR, data = data, k = 2, model
+ = FLXglm(family = poisson))
R m1

Call:
flexmix(formula = nts ~ first_brand_HOLIDAY + perc_zone1 + perc_Group_nights +
perc_num_asian + DaysBetweenStays + CROStays + DaysSinceLastStay +
wghtmean_median_age_pop100 + perc_num_white + perc_num_hispanic +
perc_CROStays + numMonthsActive + WEBStays + property_loyalty +
perc_NoZone + rho + PCR_Dummy_class + ltgold1 + ltgold3 +
p_hat_PCR, data = data, k = 2, model = FLXglm(family = poisson))

Cluster sizes:
  1   2
 93 906

convergence after 49 iterations


R rm1-refit(m1)
R
R summary(rm1)

Call:
refit(m1)

Component 1 :
  Estimate  Std. Error z value  Pr(|z|)
(Intercept) 1.0108e+00  6.4399e-01  1.5696 0.1164971
first_brand_HOLIDAY-9.3504e-01  4.6151e-01 -2.0261 0.0427594
perc_zone1  1.3936e-01  7.4383e-01  0.1874 0.8513845
...

-
Component 2 :
  Estimate  Std. Error z value  Pr(|z|)
(Intercept) 1.00799714  0.39133294  2.5758   0.01000
first_brand_HOLIDAY-0.07928984  0.15935997 -0.4976   0.61880
perc_zone1  0.01208886  0.42596711  0.0284   0.97736
...


So I cannot reproduce the problem. Is maybo one cluster in your
solution empty? The EM algorithm can end up in a local optimum with
one cluster empty ... either run flexmix() several times by hand or
use stepFlexmix() to do so automatically.

HTH,

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] sweave bwplot error

2005-04-07 Thread Friedrich . Leisch
 On Thu, 07 Apr 2005 13:24:42 +0200,
 Christoph Lehmann (CL) wrote:

   Hi
   I use sweave and have a problem with the following figure, but not with 
   other figures:

   tt - data.frame(c(a, b, c), c(1.2, 3, 4.5))
   names(tt) - c(x1, x2)
   bwplot(x2 ~x1, data = tt)

   ok now in sweave:

   \begin{figure}[H]
  \begin{center}
   echo=FALSE, fig=TRUE, height=5, width=10=
   lset(col.whitebg())
   bwplot(x2 ~x1, data = tt)
   @
\caption{xxx}
  \end{center}
   \end{figure}

   PROBLEM:
   the pdf of the figure is not correctly created (neither the esp) and the 
   error I get from sweave is:
   pdf inclusion: required page does not exist 0


From the Sweave FAQ:


A.6  Why do R lattice graphics not work?

The commands in package lattice have different behavior than the
standard plot commands in the base package: lattice commands return an
object of class trellis, the actual plotting is performed by the
print method for the class. Encapsulating calls to lattice functions
in print() statements should do the trick, e.g.:

fig=TRUE=  
library(lattice)  
print(bwplot(1:10))  
@

should work.

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] plot(bclust) what is the 2nd plot?

2005-03-09 Thread Friedrich . Leisch
 On Wed, 9 Mar 2005 10:36:49 -,
 Jacqueline Hall (JH) wrote:

   Hi everyone,
   Currently i'm trying to understand the bagged clustering algorithm, bclust
   {e1071}. 
 
   When I run the given example in the help file (as below)
 data(iris)
bc1 - bclust(iris[,1:4], 3, base.centers=5)
plot(bc1)

   and plot the bclust object, 2 graphs are produced. 
   The first is a dendrogram, but what is the second plot? The axes are not
   labelled and what do the two lines represent?

 
The monotonic decreasing line gives the relative height of the split
of tyhe tree into 2, 3, etc. branches, the second line is the first
differences of the first. A peak in the differencescan be used as a
crude estimation for the number of clusters.

   I tried looking in the URL
   given in the references but that didn't help.

Look at Section IV.A of the working paper.

HTH,

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Putting different colors on labels in plot (hclust)

2005-03-03 Thread Friedrich . Leisch
 On Thu, 3 Mar 2005 11:00:10 +0100,
 JSPC (Jeppe Skytte Spicker) (J(SS) wrote:

   Hi All R-helpers
   This is my first (but probartly not last ;-) mail to R-help, so hello to 
everybody.

   My problem: Is there a way to give colors to the labels (sample labels) in 
plots for a hclust object for better visualization?

   I have looked through plot, points, hclust and more but cannot find 
anything on label color. Anybody know if this is doable?

Have a look at example(dendrogram).

Hth,

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Sweave and \input or \include LaTeX commands

2005-03-01 Thread Friedrich . Leisch
 On Tue, 01 Mar 2005 07:53:47 +0100,
 Gregor GORJANC (GG) wrote:

   Hi!
   What is wrong if there would be the same command?

2  reasons:

1) I try to keep the Sweave and LaTeX namespaces disjunct, i.e., I
   currently do not overload regular LaTeX commands with a different
   meaning, and I want to keep it that way.

2) If it is the same command, then I you can already take bets on
   the date of the first bug report claiming that Sweave's \input{}
   command behaves differently that LaTeX's, e.g., by not searching
   .Rnw files along the TEXINPUTS path, etc.

I currently also plan only a \SweaveInput{}, but no \SweaveInclude{}
(the former is much easier to implement, because I don't have to
switch output files in the middle of operation).


   Recall my example from 
   previous posts and at the end of this mail. If I have a file a.Rnw and this
   one inputs file a1.Rnw. My idea was that Sweave would check \input{a1} or 
   \include{a1} statements. If file a1 would have extension .Rnw it would
   parse it otherwise (i.e. having .tex) it would skip it. Sweave would just 
   parse .Rnw files, while latex would put all of them in one file during 
   typesetting.

   Example:
   - we have files
  a.Rnw, which has \input{a1} or \include{a1}
  a1.Rnw

Note that theese are *not* the same under LaTeX

   - run Sweave(a.Rnw) and you get
  a.tex
  a1.tex

Nope, for \input{a1} you would get only a.tex. From the LaTeX
documentation:

**
   `\input{file}'

   The `\input' command causes the indicated `file' to be read and
processed, exactly as if its contents had been inserted in the current
file at that point.  The file name may be a complete file name with
extension or just a first name, in which case the file `file.tex' is
used.
**


That is easy to implement, because I read the .Rnw file, replace
(recursively) all \SweaveInput{} statements with their contents until
no more \SweaveInput{} statements are found (here the unique name
comes in handy ;-) and then process as usual.

If you want a fancier system with include statements I am happily
waiting for your code implementing it.

Best,
Fritz

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Sweave and \input or \include LaTeX commands

2005-03-01 Thread Friedrich . Leisch

 On Tue, 1 Mar 2005 12:08:25 + (UTC),
 Gabor Grothendieck (GG) wrote:

Friedrich.Leisch at tuwien.ac.at writes:
   I currently also plan only a \SweaveInput{}, 

   I agree that its clearer to keep the two systems distinct rather
   than having subtle changes in functionality depending on the
   extension of the file in \input.

   While we are discussing I just wanted to bring two related points up
   regarding how Sweave and R CMD interact.

   1. As mentioned in a previous post in this thread, if I don't
   want R CMD CHECK to process a certain portion of my vignette 
   (since its involves lengthy processing or software that might not
   be available on other systems) I place that portion into a file 
   called sub, say, with no extension so that R CMD CHECK does not know 
   its a Sweave file (and therefore automatically process it).  I then 
   process it manually with Sweave:  Sweave(sub) and in my main file, 
   main.Rnw, have an input statement

   \input{sub.tex}

   The only thing that's a bit confusing is that sub has no extension
   but otherwise this has the intended effect of letting me circumvent
   the R CMD CHECK for sub.   This is all ok, it works fine, but I 
   was just wondering if there are any clearer ways of achieving this
   effect.  I guess I could use an extension such as .Rnw-hide or
   use the .Rbuildignore file to mask it (although using .Rbuildignore
   in that way has the disadvantage that it would be entirely excluded 
   from the build) but was just wondering if there is some standard way 
   of dealing with this situation.

Both R and TeX are programming languages, and both feature if/else
statements, so you can easily do

if(FAST){
  load(pre-computed-results.RData)
}
else{
  res = compute.results()
  save(res, file=pre-computed-results.RData)
}

But note that vignettes are meant as introductionary material
containing user-runnable examples, so putting lengthy computations in
there might not serve that purpose too well (depends on the packages
and application, of course).


   2. A second problem that is related is that I think there should
   be an easy way to include a .pdf vignette that was not generated
   by Sweave or even latex.  Currently, as I under it, one must use 
   Sweave since the package building process uses the \VignetteIndexEntry 
   and associated commands to know how to process the build.  If this
   is already possible then can someone indicate how its done.  Some
   time ago I raised this point but no one responded at that time.


Packages already can have documentation in arbitrary formats (although
we strongly recommend PDF) in the inst/doc directory and many packages
on CRAN do have non-Sweave docs.  The directory is linked into the
help.start() version of the help system (HTML help in the Windows
Help menu). If inst/doc contains a file index.html that is used as a
TOC for the package docs. I decided to call those other documentation
objects user guides mostly because I had no better idea.

I think we should not call them vignettes for several reasons.  Users
should be able to expect that they can easily get and execute the code
contained in a vignette. r-devel contains a poor man's non-gui
version of Bioconductor's vExplorer() where the edit() method for
vignette objects opens the code in an editor. It would be absolutely
fine with me to use alternative methods for vignettes than Sweave (I
am unlikely to implement any ;-), but code extraction for testing and
learning is a key concept.

So a PDF file at the moment does not qualify as a vignette, and that
is not because of missing \VignetteIndexEntry{} statements, but
because you cannot extract the code from the file. The vignette
concept of documents where you can do computations on the code
contained in the document is by no means limited to Sweave, but
currently we do not have any other implementation which can be
installed on all key platforms without too much difficulty.


BTW, I think this discussion is getting way too technical for the
r-help list - if this thread goes on it should do so on r-devel.

Best,

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Sweave and \input or \include LaTeX commands

2005-02-27 Thread Friedrich . Leisch
 On Sun, 27 Feb 2005 12:32:44 + (UTC),
 Gabor Grothendieck (GG) wrote:

[...]

   Since this might not be desirable in all instances,
   if Sweave were to have an include facility then it should
   not be implemented in such a way that the latex include facility
   can no longer be used.  The point was just that it should be possible 
   to do the include at the Sweave or at the latex level.  

I agree that it should not be the same command. I have put an
\SweaveInput{} on my 2do list, should be doable for R 2.1.0.

Best,
Fritz

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Re: Run Sweave and LaTeX directly from command line

2005-02-23 Thread Friedrich . Leisch
 On Tue, 22 Feb 2005 20:21:46 -0600,
 Dirk Eddelbuettel (DE) wrote:

   On 22 February 2005 at 14:58, [EMAIL PROTECTED] wrote:
   | side note 2: For make afficionados the follwing 2 rules in combination
   | with the Sweave script from the FAQ do almost the same (that's what I
   | use :-)

   Sure, but it requires a (arguably small) Makefile in every sweave project
   directory.

Not really, the way I do it is that I have a $HOME/etc/Makeconf with a
lot of personal rules like those for .Snw files, and in my .bashrc I
define

fmake ()
{
make -f ~/etc/Makeconf $*
}

such that calling fmake instead of make gives me my private rules in
every place I need them :-)



   Would you consider integrating Gregor's script (or a suitable
   modification) instead?

Yes, sure, that's why I made him aware of texi2dvi: At least on Unix
systems we make sure that that is always available, while rubber might
not be. On the other hand, the R 2-liner I mentioned in an earlier
mail might be the better way to go. I always use the make rules I
described, hence had no need for either one of them - none is in the
R sources (yet).

Best,
Fritz

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] Run Sweave and LaTeX directly from command line

2005-02-23 Thread Friedrich . Leisch
 On Tue, 22 Feb 2005 20:46:01 +0100,
 Gorjanc Gregor (GG) wrote:

   Gabor,
   I definitely agree about use of R, however I am not so much in R 
   as I am in Bash. It took me less than two hours to write this script.

   At home I use R under windows and I solve problem of portability 
   with Cygwin. I know that this is not optimal solution for everyone 
   but ...

   Can you provide me some insights/thoughts how this script might be 
   written in R? I am open for discussion and cooperation on this script.



   What do you think Friedrich? I must look at this texi2dvi. I didn't 
   hav any experience with it jet. I will look at it.

Well, I didn't know about rubber before I read your script ... seems
like the 2 do the same job. Some windows installations have a tool
called texify which again does the same: run latex, bibtex, etc. as
many times as needed.

Ad shell vs. R: In R we already have almost all that is needed:

example(Sweave)
library(tools)
texi2dvi(Sweave-test-1.tex)

should do what you want ... and a Snw2dvi function is the
corresponding 2-liner. If there is need for it I'm happy to include it
in package utils.

HTH,
Fritz

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Re: Run Sweave and LaTeX directly from command line

2005-02-22 Thread Friedrich . Leisch
 On Tue, 22 Feb 2005 14:29:00 +0100,
 Gregor GORJANC (GG) wrote:

   Hello!
   Those of you, who use Sweave a lot, will probably find my shell script 
   usable. You can get it at:

   http://www.bfro.uni-lj.si/MR/ggorjan/programs/shell/Sweave.sh

   No warranty, however don't hesitate to contact me if you find an error or 
   have a patch!

Very nice!

Side note 1: R ships a version of texi2dvi, hence you might use that
one in case rubber is not found.

side note 2: For make afficionados the follwing 2 rules in combination
with the Sweave script from the FAQ do almost the same (that's what I
use :-)

%.tex: %.Rnw
Sweave $

%.pdf : %.tex
texi2dvi --clean --pdf $


Best,
Fritz Leisch

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Sweave and connections

2005-02-07 Thread Friedrich . Leisch
 On Mon, 7 Feb 2005 12:32:13 +0100,
 Göran Broström (GB) wrote:

   I'm learning to use Sweave (it's really great!) and everything works fine,
   except that occasionally I get, after having sweaved many times, 
   --
   Sweave(report.Snw)
   Writing to file report.tex
   Processing code chunks ...
1 : term hide

   Error:  chunk 1 
   Error in file(file, encoding = encoding) : 
   All connections are in use
   --
   This is no big problem, since it helps to close and reopen the R session,
   but I wonder if I can avoid this, by closing connections or something
   similar. (I really have no idea of what is going on!)

This should happen only if you have errors in the Sweave document:
then Sweave may have no chance to close the output file properly.

showConnections() lists all open connections, and you may guess what
closeAllConnections() does :-)

HTH,
Fritz

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] autoscaling plot font size in Sweave output possible?

2005-01-08 Thread Friedrich . Leisch
 On Sat, 08 Jan 2005 03:59:14 +0100,
 Patrick Drechsler (PD) wrote:

   Hi Friedrich,
   Friedrich Leisch wrote on 07 Jan 2005 09:49:04 MET:

   thanks for taking the time!

   On Thu, 06 Jan 2005 23:56:31 +0100,
   Patrick Drechsler (PD) wrote:

   I was wondering if it's possible to have fonts in plots to be
   autoscaled to the same font size used by LaTeX in a
   surrounding Sweave document.
   
   Not using the standard mechanism, because there figures are
   rescaled *after* they are created, and the font is rescaled
   together with the rest.

   ..I was afraid of that...

   What yoy have to do is:
   
   1) Create your own Sweave.sty file
   [...]

   Ok...

   2) Explicitly set height and width of each figure chunk to what
   it should be in the final document. Unfortunately you cannot
   use any fractions of \textwidth or the like because Sweawe has
   no means to know what that might be.

   see below...

   3) Set the font size to what you use in the tex document using
   ps.options().

   see below...

   Could you or somebody else enhance my OP in this sence to
   demonstrate the effect intended? I've fiddled around with
   `postscrict' and `ps.options' all day long but haven't reached a
   working file. The problem is most likely sitting in front of the
   keyboard.

   It is because of 2) that I didn't follow this route for the
   current defaults, and I haven't found a really convincing
   alternative which works in most situations ...

   Not knowing if it's actually going to help me: Can you point me
   to the file which does the conversion to the *.tex file? I've
   tried `locate sweave' on my linux box and there wasn't anything
   in the results concerning the conversion to TeX.

???

Sweave is part of package utils (which the help page clearly
indicates), the particular driver for Latex is called RweaveLatex and
referenced in the Sweave help page. If you want to have a look at the
source code the easiest thing is to get the R sources and browse in
the sources of package utils ... I'll leave it to you to figure out
which of the files contains the Sweave R code.


   I'm one of those guys that wants to have nice looking results at
   the end with all plots having the same layout.

To me it sounds much more like you're one of those guys who like it
when others solve their problems for free. I gave you an IMO perfectly
working cookbook recipe and you didn't even bother to tell me what did
not work out for you, only a see below to completely different
things (export from MATLAB isn't exactly helping me in guessing what
went wrong for you).

As christmas present (mostly to other who bother to follow the thread)
attached a solution that has exactly the same font in plots and normal
text (and was obtained by simply following the recipe I gave in my
earlier email step by step).

Best,
Fritz


* file.Rnw *

\documentclass{article}

\newcommand{\mytext}{some x label --- some y label --- some x label
  --- some y label}

\usepackage{MySweave}
\usepackage{times}

\begin{document}

\mytext

results=hide,echo=false=
ps.options(pointsize=10,family=Times)

test0,echo=F,fig=T,width=2,height=2=
x - 1:10
y - sin(x)
plot(x,y,
 xlab=some x label,
 ylab=some y label
 )
@

\mytext


test1,echo=F,fig=T,width=4,height=4=
plot(x,y,
 xlab=some x label,
 ylab=some y label
 )
@ %def 

\mytext

\end{document}


* MySweave.sty ***

\RequirePackage[T1]{fontenc}
\RequirePackage{graphicx,ae,fancyvrb}
\IfFileExists{upquote.sty}{\RequirePackage{upquote}}{}

\DefineVerbatimEnvironment{Sinput}{Verbatim}{fontshape=sl}
\DefineVerbatimEnvironment{Soutput}{Verbatim}{}
\DefineVerbatimEnvironment{Scode}{Verbatim}{fontshape=sl}

\newenvironment{Schunk}{}{}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] autoscaling plot font size in Sweave output possible?

2005-01-07 Thread Friedrich . Leisch
 On Thu, 06 Jan 2005 23:56:31 +0100,
 Patrick Drechsler (PD) wrote:

   Hi,
   I was wondering if it's possible to have fonts in plots to be
   autoscaled to the same font size used by LaTeX in a surrounding
   Sweave document.

Not using the standard mechanism, because there figures are rescaled
*after* they are created, and the font is rescaled together with the rest.

What yoy have to do is:

1) Create your own Sweave.sty file, say MySweave.sty which is a copy
   of the ofiginal one *without* the \setkeys{Gin} line and insert a

   \usepackage{MySweave}

   in the .Rnw document.


2) Explicitly set height and width of each figure chunk to what it
   should be in the final document. Unfortunately you cannot use any
   fractions of \textwidth or the like because Sweawe has no means to
   know what that might be.

3) Set the font size to what you use in the tex document using
   ps.options().


It is because of 2) that I didn't follow this route for the current
defaults, and I haven't found a really convincing alternative which
works in most situations ...

Hth,
Fritz

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Sweave and transparent PDF?

2004-11-05 Thread Friedrich . Leisch
 On Thu, 04 Nov 2004 14:20:21 +0100,
 Benno Pütz (BP) wrote:

   Hello,
   I have run across the following problem:

   Creating PDF files manually by using

   pdf(version=1.4)

   I can make graphs using the new transparency feature of R2.0. If, 
   however, I try to create the same graphs with Sweave, all transparent 
   stuff is gone. This os likely due to the default version parameter in in 
   pdf().

   How can I tell Sweave to use the newer PDF version? The parameter seems 
   to be hard-coded (not via some option) and I could not come up with some 
   kind of hook ...

Good point, currently I see no way short of directly creating the PDF
file and manually including it in latex, i.e., do

**
fig=false=
pdf(file=foo.pdf, version=1.4)
myplot(...)
dev.off()
@

\incudegraphics{foo}
**


But we should think about a more general mechansim to specify defaults
for the PDF device (not only for Sweave).

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] unable to open connection

2004-10-25 Thread Friedrich . Leisch
 On Mon, 25 Oct 2004 10:10:06 +0200,
 Uwe Ligges (UL) wrote:

   Prof Brian Ripley wrote:

   Actually, you are unable to connect to the Internet from R on your 
   computer.  Perhaps you are not connected, or need to set a proxy?
   
   Please read the rw-FAQ, as the posting guide asks.
   
   Note that right now you there are no packages on CRAN and Bioconductor has
   not yet released packages for R 2.0.x.  The first is a short-term problem,

   Yes, unfotunately, there was a network breakdown caused by a broken 
   router (that one that connects the whole building with the world) over 
   the weekend - and our department has no access to that machine. The 
   problem is solved now.

   Windows binaries will soon be back on CRAN.

They are now on the CRAN master site, mirrors may take a day or two to
recover.

Best,
Fritz Leisch

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Pixmap problem

2004-09-29 Thread Friedrich Leisch
 On Wed, 25 Aug 2004 21:42:55 +0200 (CEST),
 Roger Bivand (RB) wrote:

   On Wed, 25 Aug 2004, Benjamin Lloyd-Hughes wrote:
   Hi,
   
   I'm having trouble writing .pnm images which I think is due to a problem
   with my colour space.  The pixmap object seems to be looking for 72 of 8
   colours (one per cell?) which doesn't seem healthy...
   
library(pixmap)
x - pixmapIndexed(rep(1:8, 9), nrow=6, col=rainbow(8))
x
   Pixmap image
   Type  : pixmapIndexed 
   Size  : 6x12 
   Resolution: 1x1 
   Bounding box  : 0 0 12 6 
   Nr. of colors : 72 of 8 
   
write.pnm(x, file=D:/Temp/output.pnm)
   Error in options(x) : evaluation nested too deeply: infinite recursion /
   options(expression=)?

   This one is in:

   x - pixmapIndexed(rep(1:8, 9), nrow=6, col=rainbow(8))
   as(x, pixmapRGB)
   Error in options(x) : evaluation nested too deeply: infinite recursion / 
   options(expression=)?


Actually that was a bug in the methods package of R which was
triggered by pixmap, i.e., no pixmap problem. It has been fixed in the
soon to be released version 2.0.0 of R. Sorry for the late answer, I
have been travelling for most of the last month and didn't have
Internet access all the time, hence the pile of unanswered emails got
larger and larger.

Best,
Fritz

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [Rd] Re: [R] Sweave echoing comments (again)

2004-09-13 Thread Friedrich . Leisch
 On Wed, 08 Sep 2004 17:46:51 +0200,
 Wolski  (W) wrote:

   Hi!
   I observed it also. There are cases where it is not desirable. It
   will be quite helpfull, if possible, to have a parameter that
   allows one to switch of removing the #comments.

The problem is that the parser does not keep the comments, and I need
to parse  deparse the source in order to know when expressions are
complete, such that I can insert the ourtput in the right places.

Currently there is no way of keepng the comments in Sweave code
chunks.

Best,
Fritz

PS: I am promising a workaround for quite some time now, but haven't
had the time to code that yet, so don't hold your breath.

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Apparent conflict between \Sexpr in Sweave and R2HTML

2004-07-06 Thread Friedrich . Leisch
 On Mon, 05 Jul 2004 09:08:38 -0700,
 Scott Waichler (SW) wrote:

   I have come across an apparent bug in the operation of Sweave.  If I
   load the package R2HTML then execution of \Sexpr{} in an *.Rnw file no
   longer works.  The \Sexpr{} code is simply written to the *.tex file.
   Below are my *.Rnw file, commands, and output.  

R2HTML registers another Sweave driver for HTML files, and after that
the Syntax for HTML is in the search list before the default syntax.

options(SweaveSyntax=SweaveSyntaxNoweb)

or calling Sweave like

Sweave(..., syntax=SweaveSyntaxNoweb)

should do the trick.  I'll add this to the Sweave FAQ.

Best,
Fritz

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Sweave and echoing R comments

2004-06-21 Thread Friedrich . Leisch
 On Sun, 20 Jun 2004 20:34:50 +,
 Frank E Harrell (FEH) wrote:

   Charles H. Franklin wrote:
   Is there any way to echo comments from an R source file into an 
  SWeave- LaTeX document?
   
   Example:
   
   # Npop is population total
   # Npoph0..Npoph2 are stratum totals
   # Npoph is vector of stratum totals
   
   Npop-sum(to2000)
   
   Npoph0-sum(to2000[bg==0])
   Npoph1-sum(to2000[bg==1])
   Npoph2-sum(to2000[bg==2])
   
   Npoph-c(Npoph0,Npoph1,Npoph2)
   
   
   
   In the final LaTeX document, I'd like the comments to be echoed so 
   readers other than me have guidance about variable names etc.
   
   I suppose advocates of literate programming might argue that if the 
   comment is important it should be in the body of the .snw file, not 
   merely as R comments. Still... it seems easier to use brief comments in 
   the code itself and more explanatory text in the body of the document.
   
   Searches of Sweave and comment in the list and documentation didn't 
   turn up anything about echoing comments in either R or Sweave.
   
   
   Thanks.
   
   Charles
   


   I agree that it would be nice to see comments in the output.  I hope 
   that Fritz Leisch will consider adding a hook that is a user-provided R 
   function that take vectors of character strings representing a chunk of 
   code and generating any desired LaTeX markup for pretty printing of the 
   code.  The function would return character vectors in LaTeX format.  I 
   like comments to appear in a smaller font, and for certain character 
   translations, such as - being replaced with a left arrow.

I agree that it would be nice, and it is on my list of things I want
to do over the summer ...

Best,

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Sweave and R output: possible to suppress Schunk tags in *.tex file output?

2004-03-16 Thread Friedrich . Leisch
 On Fri, 12 Mar 2004 08:38:53 -0800,
 Waichler, Scott R (WSR) wrote:

   Hello,
   I would like to fill the rows of a Latex tabular environment with output from
   R, as in

   \begin{table}
 \caption{Table caption.} 
 \label{tab:events}
 \begin{tabular}{c r r r r r}
 \hline

   echo=false,results=tex=
   fill.my.table.rows()
   @

 \end{tabular}
   \end{table}

   Sweave produces the output inside \begin{Schunk} and \end{Schunk} commands,
   which latex doesn't tolerate within a table.  I would prefer to avoid writing all 
of
   the Latex table code from R.  Is my only other option to produce a separate
   text file, e.g. under Sweave with results=hide, then use \input{}
   on the file?

Oops, that's a bug in Sweave ... the Schunk shouldn't be there in that
case. I will fix it for 1.9.0.

Best,

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071  [EMAIL PROTECTED]
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Sweave and R output: possible to suppress Schunk tags in *.tex file output?

2004-03-15 Thread Friedrich . Leisch
 On Fri, 12 Mar 2004 08:38:53 -0800,
 Waichler, Scott R (WSR) wrote:

   Hello,
   I would like to fill the rows of a Latex tabular environment with output from
   R, as in

   \begin{table}
 \caption{Table caption.} 
 \label{tab:events}
 \begin{tabular}{c r r r r r}
 \hline

   echo=false,results=tex=
   fill.my.table.rows()
   @

 \end{tabular}
   \end{table}

   Sweave produces the output inside \begin{Schunk} and \end{Schunk} commands,
   which latex doesn't tolerate within a table.  I would prefer to avoid writing all 
of
   the Latex table code from R.  Is my only other option to produce a separate
   text file, e.g. under Sweave with results=hide, then use \input{} on the file?

results=tex will do what you want, i.e., produce no Soutput and Schunk
environments. you may also want to look at package xtable.

best,

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071  [EMAIL PROTECTED]
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] RE: system.time(), sys.time() etc

2004-02-26 Thread Friedrich . Leisch
 On Thu, 26 Feb 2004 10:08:36 -0500,
 Liaw, Andy (LA) wrote:

   From: Spencer Graves [mailto:[EMAIL PROTECTED] 
   
   Martin says, This is another instance of S-Plus following R 
   behind and doing it incompatibly [with a reason?] ... .
   
   This is one example of a major issue in how to wage and win a 
   standards war, discussed by Shapiro and Varian (1998) 
   Information Rules 
   (Harvard Business School Press).  Whether you're Bill Gates or Larry 
   Ellison, you want to make it easy for people to move to your product 
   from a competitor but expensive for your current customers to 
   escape to 
   the competition. 
   
   Spencer Graves

   But I believe neither Insightful nor R-core would want to see each other as
   competitor.  (Reality might be quite different.)  It would not be in the
   best interest of either party.

   (Apologies for putting words in R-Core's mouth.  As for Insightful, at least
   that's David Smith's word when he talked about `Future of S-PLUs' at the
   2002 Insightful Technology Conference.)


I never saw R about trying to be a competition or replacement for
Splus, in fact many of us in R Core think that it is an advantage for
R that there also is a commercially supported version of S. I
personally would rather like to see if S (i.e. R and Splus combined)
gain market share at the cost of certain other statistical software
packages (e.g., ones matching the regular expression S..?S :-)

Best,
Fritz

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] latex problem with Sweave output file under Debian

2004-02-18 Thread Friedrich . Leisch
 On Wed, 18 Feb 2004 18:19:48 -0600 (CST),
 Dan Davison (DD) wrote:

   Could someone tell me how to end the trouble I'm encountering when
   running latex on the .tex file produced by Sweave()? Sweave() seems to
   process the example file
   (http://www.ci.tuwien.ac.at/~leisch/Sweave/example-1.Snw) without
   problems, and the file example-1.tex produced is the same as in the Sweave
   manual. However, when I run latex on example-1.tex, many error messages
   and requests for user input are generated (below). And when I view the
   .dvi that eventually results with xdvi it is empty apart from a small
   graphic containing the box plot that shouldbe there; there is no text.
   latex produces apparently perfect .dvi files when the .tex files are 
   not produced by Sweave.

[...]

   ! LaTeX Error: File `ae.sty' not found.

   Type X to quit or RETURN to proceed,
   or enter new name. (Default extension: sty)

   Enter file name: 

   ! LaTeX Error: File `fancyvrb.sty' not found.

   Type X to quit or RETURN to proceed,
   or enter new name. (Default extension: sty)

   Enter file name: 


Well, both ae.sty and fancyvrb.sty seem not to be installed on your
system ... probably you don't have the tetex-extra package installed.

.f

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071  [EMAIL PROTECTED]
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] R News Volume 3/3

2004-01-21 Thread Friedrich . Leisch

We have published the 2003/3 issue of R News on

http://cran.R-project.org/doc/Rnews

where you can download the newsletter as PDF or Postscript file. It
will propagate to the CRAN mirrors within a day or two.

Contents of this issue:

Dimensional Reduction for Data Mapping
R as a Simulation Platform in Ecological Modelling
Using R for Estimating Longitudinal Student Achievement Models
lmeSplines
Debugging Without (Too Many) Tears
Th R2HTML Package
R Help Desk: Package Management
Programmer's Niche: Regular Expressions
Recent Events
Upcoming Events
Changes in R 1.8.1
Changes on CRAN
R Foundation News


For the editorial board,
Fritz Leisch

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071  [EMAIL PROTECTED]
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

___
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-announce

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Sweave and X11 on OSX 10.3

2004-01-07 Thread Friedrich . Leisch
 On Tue, 6 Jan 2004 23:44:42 -0700 (MST),
 Kieran Healy (KH) wrote:

   Hi -
   I'm running R 1.8.1 (compiled from source) on Mac OS X 10.3 (Panther). I
   find that, if Apple's X11 application is not running, Sweave gives an
   error when it wants to create a pdf or eps figure. E.g., in the package's
   own example-1.Snw file a boxplot is created at chunk 2:

   fig=TRUE,echo=FALSE=
   boxplot(Ozone ~ Month, data = airquality)
   @

   Normally this will create a pdf and an eps version of the boxplot. I get:

   Sweave(example-1.Snw)
   Writing to file example-1.tex
   Processing code chunks ...
1 : echo term verbatim
2 : term verbatim eps pdf
   Warning message:
   unable to open connection to X11 display`'

   Error:  chunk 2
   Error in X11(display, width, height, pointsize, gamma, colortype,
   maxcubesize,  :
   unable to start device X11

   If I start the X11 application, Sweave runs as normal but displays any
   figures on an x11() device in addition to creating the eps / pdf files.

   I don't remember this happening before and experience teaches me to assume
   the issue is with my own setup rather than Sewave. Maybe there's a
   problem with the DISPLAY variable, or something that I did while upgrading
   to Panther -- but I can't see what it is. Has anyone else had this
   issue?

Your R session has obviously x11() as the default plotting device
... e.g.,

plot(1:10)

at the prompt should also give an error, if no graphics device is
open. I don't know too much about MacOS X, but having the DISPLAY
variable set without having an X11 server surely means asking for
trouble on Linux, and I guess MacOS X is not different ...

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071  [EMAIL PROTECTED]
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Sweave and X11 on OSX 10.3

2004-01-07 Thread Friedrich . Leisch
 On Wed, 7 Jan 2004 08:30:04 -0800 (PST),
 Thomas Lumley (TL) wrote:

   On Wed, 7 Jan 2004 [EMAIL PROTECTED] wrote:
   open. I don't know too much about MacOS X, but having the DISPLAY
   variable set without having an X11 server surely means asking for
   trouble on Linux, and I guess MacOS X is not different ...
   

   Yes, except there is no excuse for doing this under Linux and there are
   good reasons for doing it on OS X.  Under Linux, if you are running X then
   all your terminals were probably started after the X server, and they are
   usually children of the X root window.  Under OS X the terminals are
   usually started independently of X11 and may have been running before the
   X server was started.  I don't know any automatic way to have DISPLAY set
   correctly when the server is running and unset when it isn't.

   The result is that you either need to have DISPLAY set in .tcshrc or
   equivalent, or remember to set it when needed.

I see, could in this case R for the Mac be smarter about what the
default graphics device should be? This is not an Sweave issue, it
simply means that under the setup described above any call to plot()
---without actively opening a device first---will fail ...

.f

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] passing par() options to pdf under Sweave

2003-12-05 Thread Friedrich . Leisch
 On Thu, 4 Dec 2003 15:58:32 -0800 (PST),
 Anne York (AY) wrote:

   I'm using Sweave to generate LaTeX output from R. Thank-you 
   very much for this capability. It is very useful.

   Could someone please tell me how to pass non-default 
   graphics parameters from par() to the pdf driver when it is 
   called by Sweave? 

   (I need to change some of the margin defaults. )

   Hoping there is an easy solution to this question,

Yes, simply define a hook function for figure chunks: The effect of

options(SweaveHooks=list(fig=function() par(bg=red, fg=blue)))


should be easy to see :-) The hook function will be executed at the
beginning of each chunk where fig=true (i.e., all figure chunks).


What you want is something like

options(SweaveHooks=list(fig=function() par(mar=c(1,2,3,4


Hope this helps,

-- 
---
Friedrich  Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071  [EMAIL PROTECTED]
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Fwd: License Agreement

2003-11-18 Thread Friedrich . Leisch
 On Mon, 17 Nov 2003 14:01:17 -0500,
 Sigrid Volko (SV) wrote:


   Dear Mr. Leisch,

[don't know why you assume that I'm behind r-help ... but anyway ...

   I was asked by one of our faculty members at Johns Hopkins University to =
   assist him in licensing a software application that he has developed. This =
   package is based on R, the statistical software that is distributed as =
   freeware. In the course of my due diligence analysis, I reviewed the =
   official R web page which states that R is an official part of the Free =
   Software Foundation's GNU project. However, it does not explicitly state =
   under which License Agreement R is made available. Reviewing the GNU =
   official web page, I assume that R is made available under the GNU General =
   Public License. I would, however, appreciate if you could confirm that =
   this information is correct.=20


I think the web page clearly states that R is indeed distributed under
the terms of the GPL ... and if you use R you get a pointer to the GPL
every time you start it.

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071  [EMAIL PROTECTED]
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] R News Volume 3/2

2003-10-30 Thread Friedrich . Leisch

We have published the 2003/2 issue of R News on

http://cran.R-project.org/doc/Rnews

where you can download the newsletter as PDF or Postscript file. It
will propagate to the CRAN mirrors within a day or two.

Contents of this issue:
  
R Help Desk
Integrating grid Graphics Output with Base Graphics Output
A New Package for the General Error Distribution
Web-based Microarray Analysis using Bioconductor
Sweave, Part II: Package Vignettes
R Foundation News
Recent Events
Book Reviews
Changes in R 1.8.0
Changes on CRAN
Crossword Solution
Correction to ``Building Microsoft Windows Versions of R and R
packages under Intel Linux''


For the editorial board,
Fritz Leisch

-- 
---
Friedrich  Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071  [EMAIL PROTECTED]
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

___
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-announce

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] CRAN down on Sunday, 26.10.2003

2003-10-24 Thread Friedrich . Leisch

Due to construction work in a neighboring building there will be a
power outage in our offices for the complete day of

Sunday, 26.10.2003

which means we will shut down all our computers some time tomorrow and
reboot them Monday morning (central European time).

This includes the server for

www.R-project.org
cran.R-project.org
cran.at.R-project.org

Please a mirror site on this day (and do not flood us with bug
reports stating that CRAN is down :-).

Best,

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071  [EMAIL PROTECTED]
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

___
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-announce

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] using identify() together with plot () and pixmap()

2003-09-30 Thread Friedrich . Leisch
 On Tue, 30 Sep 2003 10:16:11 +0200,
 Christoph Lehmann (CL) wrote:

   Dear R users
   I have a two-dimensional array, whose values I want to plot, using the
   pixmapGrey class. Plotting works fine, and now I would like to be able
   to identify some of the points in the plot using identify(). But I get
   the following message while pressing the left mouse button:

   plot(pixmapGrey(fmri.vtc[,,slice,volume]))
   identify(fmri.vtc[,,slice,volume])
   warning: no point with 0.25 inches


identify() needs x and y values, you are passing it the z values of
the image.

Maybe you want to use locator()?

.f

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] using identify() together with plot () and pixmap()

2003-09-30 Thread Friedrich . Leisch
 On Tue, 30 Sep 2003 09:38:31 +0100,
 Barry Rowlingson (BR) wrote:

   Christoph Lehmann wrote:
   plot(pixmapGrey(fmri.vtc[,,slice,volume]))
   identify(fmri.vtc[,,slice,volume])
   
   warning: no point with 0.25 inches
   
   
   pressing the right mouse button I get:
   numeric(0)
   
   what is the problem  here and how can I solve it?

 The problem is that there is no method for identifying points on a 
   pixmap (and anyway, you are feeding identify() a matrix).

 You'll need to write an identify.pixmapGrey function. This would do 
   something like use the 'locator()' function to get clicks on the screen, 
   and then it would compute which grid cell the coordinates of those 
   clicks were in. pixmap objects store enough information for you to work 
   this out from the attributes - look at the 'bbox' attribute for example.

 It would make a nice addition to the pixmap library. Although one 
   thing that just suprised me was that the different flavours of pixmap - 
   pixmapGrey, pixmapIndexed, pixmapRGB - dont all inherit from a 'pixmap' 
   class,

But they do, and class pixmap has the necessary geometry
information, i.e., size, bounding box and resolution of the image.

   which might make it easier to write a single identify function 
   for all the types.

yes, shouldn't bbe too hard (all contributions welcome).

.f

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] allShortestPath function in e1071 package

2003-09-26 Thread Friedrich . Leisch
 On Thu, 25 Sep 2003 13:04:21 -0400,
 Bing Zhang (BZ) wrote:

   Hi All,
   I am using the allShortestPath function based on Floyd's algorithm in e1071 
   package. It runs great when I have less than 5000 nodes. But when I tried to 
   work on more than 5000 nodes, I ran into memory problem. The problem I really 
   want to solve has 1-15000 nodes.

   Does anybody know how to deal with this problem? Are there any other packages 
   in R that can handle this problem? Thanks!

The e1071 implementation uses NxN matrices (where N is the number of
nodes), hence it does not scale well with the number of nodes as
memory consumption is N^2.

From Bioconductor you get package graph which represent the graph
using lists of nedges and edges, and needs much fewer memeory if the
graphs is sparsely connected. Package RBGL (also from Bioconductor)
has shortest paths for such graph objects.

.f

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] overlay two pixmap

2003-09-26 Thread Friedrich . Leisch
 On Fri, 26 Sep 2003 10:32:21 +0200,
 Christoph Lehmann (CL) wrote:

   Hi
   I need to overlay two pixmaps (library (pixmap)). One, a pixmapGrey, is
   the basis, and on this I need to overlay a pixmapIndexed, BUT: the
   pixmapIndexed has set only some of its pixels to an indexed color,
   many of its pixels should not cover the basis pixmapGrey pixel, means,
   for this in pixmapIndexed not defined pixels it should be transparent.

   What would you recommend me to do? Should I go for another solution than
   pixmap?

There is no method for doing this in pixmap yet ... but if you write
one (shouldn't be too much code) I'd be happy to include it in the
package such that others can use it in the future.

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071  [EMAIL PROTECTED]
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] Re: Tutorial docs: Vignettes! {was searching R-help ..}

2003-09-25 Thread Friedrich . Leisch
 On Thu, 25 Sep 2003 16:11:57 +0200,
 Martin Maechler (MM) wrote:


   I'd recommend taking one of these (or the Bioconductor ones if
   you are using some of them!) as an example to follow.

   And many more packages have other *.pdf documents in their installed
   ./doc/ directories.  However, currently this is not shown
   in library(help = package)   
   --- nor anywhere on CRAN's package-source page (which may be
   worth improving ...)

Yes (in the long run we want a web page where you can access vignettes
directly).

BTW [shameless advertising]: there will be an article in the next
issue of R News on package vignettes (no vaporware, finished it
yesterday).

Best,
Fritz

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] R News: Call for Papers

2003-09-02 Thread Friedrich . Leisch

R News (see http://CRAN.R-project.org/doc/Rnews/) is running low on
submissions lately. If you are the author of a package on CRAN or
Bioconductor and want to attract a larger audience to your software,
you should consider writing a short article introducing the
package. Another typical kind of R News article is to describe a
data analysis application using R (not necessarily using software you
have written).

We are looking forward to all contributions!

For the editorial board,
Fritz Leisch

-- 
---
Friedrich  Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071  [EMAIL PROTECTED]
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

___
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-announce

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] CRAN package orphanizing process

2003-07-16 Thread Friedrich . Leisch

As the list of packages on CRAN becomes longer almost on a weekly
basis, we need a formal mechanism to handle the case when somebody
wants to resign from maintaining a package.


Possible reasons for orphanizing a package:

1) The current maintainer actively wants to orphanize the package,
   e.g., because he has no longer the time or interest to act as
   package maintainer.

2) The current maintainer does not answer to emails by the CRAN admins
   for longer periods of time.


The orphanizing process:

1) The package gets the special keyword ORPHANED as maintainer in
   the DESCRIPTION file, the patch level of the version number is
   increased.

2) The package is moved from $CRAN/src/contrib to
   $CRAN/src/contrin/Orphaned.

3) As long as the package passes R CMD check for the current release
   version of R, it additionally remains in $CRAN/src/contrib/.


Everybody is more than welcome to take over as maintainer of an
orphaned package. Simply download the package sources, make changes if
necessary (respecting original author and license!) and resubmit the
package to CRAN with your name as maintainer in the DESCRIPTION file
of the package.

For the CRAN admins,
Fritz Leisch

___
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-announce

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Bagged clustering and fuzzy c-means

2003-06-27 Thread Friedrich . Leisch
 On Thu, 26 Jun 2003 14:43:41 +0100,
 Xu Yun (XY) wrote:

   Dear All:
   I'm a newbie to R and chemometrics.
   Now I'm trying apply bclust on fuzzy c-means like this:
   bc1 - bclust(iris[,1:4], 3, base.centers=20,iter.base=100,
   base.method=cmeans)
   Committee Member:
   1(1)(2)(3)(4)(5)(6)(7)(8)(9)(10)(11)(12)(13)(14)(15)(16)(17)(18)(19)(20)Erro
   r in bclust(iris[, 1:4], 3, base.centers = 20, iter.base = 100, base.method
   = cmeans) :
   Could not find valid cluster solution in 20 replications
   I can't get any valid result with many parameter adjustments, such as
   iter.base, base.centers etc. But I think fcm should return similar result
   just like k-means (e.g. centers, cluster size) plus fuzzy membership
   information. Can anyone explain this for me?

cmeans expects a matrix as input, iris[,1:4] is a data.frame.

bc1 - bclust(as.matrix(iris[,1:4]), 3,
base.centers=5,iter.base=100,base.method=cmeans)

works for me.

But I agree that this behaviour is not desirable, I'll add an
x=as.matrix(x) at the beginning of both bclust and cmeans


   Besides, I'm not quite understand the meaning of bootstrap. In my view, it
   might means independent, am I correct?

No, a bootstrap sample is a sample drawn from the empirical
distribution of a data set, i.e., drawing with replacement from the
original data.

There are heaps of books explaining what bootstrapping is, simply
search for books with bootstrap in the title in your library :-)

Best,

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071  [EMAIL PROTECTED]
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] dendrograms

2003-06-26 Thread Friedrich . Leisch
 On Wed, 25 Jun 2003 06:31:49 -0400,
 Edoardo Airoldi (EA) wrote:

   Hello all,
 I am using libraries (mva,cluster) to produce dendrograms.  With 1000 
   examples the dendrogram gets too crowded, and i am wondering whether there 
   is an option (which i cannot find) to set the number of leaf nodes, like 
   in matlab, and return the plot and the assignment map examples - leaf 
   nodes.  Any suggestion is appreciated.  Thanks

Just wondering: did you try help(dendrogram) before sending an email
to r-help with subject dendrogram? The examples show you how to cut
a dendrogram at a specified height ...

If you want 10 leafs, you just have to get the height of the 9th
splitting (in element height of hclust objects).

help(cutree) might also be of interest ...

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071  [EMAIL PROTECTED]
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] R News Volume 3/1

2003-06-05 Thread Friedrich . Leisch
We have published the 2003/1 issue of R News on

http://cran.R-project.org/doc/Rnews

where you can download the newsletter as PDF or Postscript file. It
will propagate to the CRAN mirrors within a day or two.


Contents of this issue:

Name Space Management for R
Converting Packages to S4
The genetics Package
Variance Inflation Factors13
Building Microsoft Windows Versions of R and R packages under Intel Linux
Analysing Survey Data in R
Computational Gains Using RPVM on a Beowulf Cluster
R Help Desk  
Book Reviews   
Changes in R 1.7.0 
Changes on CRAN 
Crossword 
Recent Events


For the editorial board,
Fritz Leisch

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] Re: About ability of allShortestPaths function in e1071 package

2003-03-27 Thread Friedrich . Leisch
 On Thu, 27 Mar 2003 23:49:04 +0900,
 Hisaji Ono (HO) wrote:

   Hello.
R's e1071 package has allShortestPaths function using Floyd's algorithm.

It is very useful for road network analysis. I'll try to analyze facility
   allocation programs using this.

I'd like to know how much nodes this function can deal with?

And for larger nodes(for example million nodes), allShortestPaths employs
   graph partition algorithm?

no, the current implementation uses matrices to represent the graph,
hence it can only handle several thousand nodes depending on thje
amount of memory your computer has. millions of nodes is currently
impossible.

best,

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071  [EMAIL PROTECTED]
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch
---

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] multinomial conditional logit models

2003-01-30 Thread Friedrich . Leisch
 On Wed, 29 Jan 2003 11:57:20 -0800 (PST),
 John Hendrickx (JH) wrote:

   A multinomial logit model can be specified as a conditional logit
   model after restructuring the data. Doing so gives flexibility in
   imposing restrictions on the dependent variable. One application is
   to specify a loglinear model for square tables, e.g. quasi-symmetry
   or quasi-independence, as a multinomial logit model with covariates.
   Further details on this technique and examples with several packages
   are on my homepage at http://www.xs4all.nl/~jhckx/mcl/

   I've been trying to implement an MCL model in R and have been mostly
   succesful. However I'm still stuck on a few points and I'm hoping
   someone can point out how to do fix them.

   To estimate an MCL model, the data must be restructured into a
   person-choice file. 

   * Each case must be duplicated ncat times (ncat is the number of
   categories of the dependent variable)
   * Each case must be identified by a strata variable (id)
   * Each duplicate must be identified by a variable indexing the
   choices (newy)
   * A dichotomous variable must indicate which duplicate corresponds
   with the respondent's choice (didep)

I'm not completely sure if I understand your target format completely,
but it sounds like reshape() could do all you want:


R df3
  id age dose1 dose2 dose4
1  1  40 1 2 3
2  2  50 2 1 3
3  3  60 1 2 3
4  4  50 2 1 3



R reshape(df3, direction = long, idvar=1,
   varying=list(dose=c(dose1, dose2, dose4)))

id age time dose1
1.1  1  401 1
2.1  2  501 2
3.1  3  601 1
4.1  4  501 2
1.2  1  402 2
2.2  2  502 1
3.2  3  602 2
4.2  4  502 1
1.3  1  403 3
2.3  2  503 3
3.3  3  603 3
4.3  4  503 3


which is a (modified) example from help(reshape) ... there you find
much more examples.

Hope this helps,
Fritz

-- 
---
Friedrich Leisch 
Institut für Statistik  DSSTel: (+43 1) 4277 38613
Universität WienFax: (+43 1) 4277 38639
Universitätsstraße 5  [EMAIL PROTECTED]
A-1010 Wien, Austria http://www.ci.tuwien.ac.at/~leisch
---

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



Re: [R] calling sweave function from latex

2003-01-29 Thread Friedrich . Leisch
 On Wed, 29 Jan 2003 14:12:15 +1300,
 Sam McClatchie (SM) wrote:

   System info:
   Mandrake 9.0
   R Version 1.6.1
   ESS 5.1.21
   Emacs 21.2.1
   ---

   Colleagues

   I've been calling R-code embedded in my LaTex document using Sweave, but 
   would like to make things more convenient. At present as I understand it 
 you first process the R chunks of code using the Sweave function 
   called from within R to process a precursor file e.g. foo.sw to get a 
   LaTex file (foo.sw.tex) that you then process with latex foo.sw.tex.
   
   example code segment

   %\item {\bf Matched trawl and acoustic data} \label{real data}

   \item {\bf Results}

    sweave code

   echo=false,results=hide=
   average.trawl.spp.composition()
   @

    insert figure generated from sweave code
   \begin{figure}
   \includegraphics[scale=0.6]{../figures/bycatch_by_weight}
   \caption{\label{catch by weight} Proportions of selected species (from
Table \ref{ts length regressions}) in the fish assemblage using
catch rate ($kg\ km{-1}$) as an approximation for fish density
(neglecting variable capture efficiencies). Note: there were no
oblique banded rattails in this dataset, although we have a
\textit{TS-length} regression for them (see Table \ref{ts length
regressions}). Box plot centre line = meadian, box limits are
$25^{th}$ and $75^{th}$ quartiles, whiskers represent 1.5 times the
interquartile range from the median, and points outside the whiskers
are the tails of the distributions.}
   \end{figure}
   ---

   This works fine, but it is cumbersome for someone who likes to write a 
   bit and then latex that additional bit. Of course I can just add the new 
   LaTex code chunks to the foo.sw.tex and latex that, but I have to 
   remember to copy the foo.sw.tex back to foo.sw or the versions get mixed 
   up. Trivial, but annoying.

   The question is: can I call the Sweave function from within LaTex so I 
   just latex the foo.sw.tex and the Sweave chunks will also get processed. 
   This would be much tidier.

   One suspects that the short answer is 'no'.



One way to deal with this is to write several Sweave filew and collect
them into the main latex document using \input{} statements. Then you
can Sweave() only those files which have some changes, makefiles can
automate that easily.

I have some ideas on conditional processing of chunks and re-using
previously saved results in case nothing has changed, but that has not
been implemented yet.

Best,
Fritz

-- 
---
Friedrich Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071  [EMAIL PROTECTED]
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch
---

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



Re: [R] ConTEXT .chl file for R?

2003-01-24 Thread Friedrich . Leisch
 On Fri, 24 Jan 2003 04:18:14 +,
 Andrew C Ward (ACW) wrote:

   I created one of these a little while ago. If anyone would like it, email me 
   separately and I will send it to you.

   WinEdt is mentioned on CRAN (under Software/Other) and I believe is quite 
   popular among users of R for Windows. It is shareware, however, whereas ConTEXT 
   is freeware. I don't see much merit in paying for an editor when R itself is 
   free. Others may say Look what I bought with the money I saved on R :-)


CRAN carries whatever users submit to it ... the fact that there is a
WinEdt configuration file on CRAN is not because it is the officially
recommended editor for R, but because Uwe Ligges submitted his code
to CRAN and actively maintains it.
 
So if you think ConTEXT is a nice and free editor for writing R code on
windows and have already written corresponding configuration maybe you
want to share it with the rest of us? 

I personally use Emacs on Linux ... but would have use for a free and
easy-to-use windows editor for teaching (emacs is free, but not easy
to use).


Best,

-- 
---
Friedrich Leisch 
Institut für Statistik  DSSTel: (+43 1) 4277 38613
Universität WienFax: (+43 1) 4277 38639
Universitätsstraße 5  [EMAIL PROTECTED]
A-1010 Wien, Austria http://www.ci.tuwien.ac.at/~leisch
---

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



Re: [R] Loops Sweave and Many Figures

2003-01-12 Thread Friedrich . Leisch
 On Sun, 12 Jan 2003 06:03:41 +0100,
 Serguei  (S) wrote:

   Is it any way?
   This code doesn't work:
   %%%
   \multido{}{10}{
   fig=T=
   ...
   @
   }


\multido{}{10}{
fig=T,echo=F=
plot(1:10)
@ 
}


works while the samle with echo=T does not ... seems like multido
cannot hande verbatim enveronments, but that's hardly Sweave's fault.


 %%%
   Or:
   %%%
   1, fig=T=
   ...
   @
   =
   1
   @
   %%%

what is that supposed to do? if you want a figure also resulting from
the second chunk you need

1, fig=T=
...
@
fig=T=
1
@

or

\SweaveOpts{fig=T}

1=
...
@
fig=T=
1
@



Hope this helps,

-- 
---
Friedrich  Leisch 
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität WienFax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071  [EMAIL PROTECTED]
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch
---

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help