[R] Integration between R latex
As an R absolute beginner and an expert (very old) statistician and latex user, I'm interested in using R to produce AUTOMAGICALLY tables in latex format. I mean I would like to have the means to build an R procedure generating **FROM INSIDE** a table or a graph to be inserted directly into latex. I've read http://hesweb1.med.virginia.edu/biostat/s/doc/summary.pdf where the author speaks of S (not R) and Latex integration via a Hmisc library which allows to make automatic, calculated tables in latex. Unfortunately this library doesn't seem to be present in R (I tried to follow the example issuing a library(Hmisc) and then, plainly, library() but nothing with the same functions appeared). Any help on how to set up that integration? And, where can I find documentation/examples on that? Thanks Vittorio __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Integration between R latex
[EMAIL PROTECTED] schrieb: As an R absolute beginner and an expert (very old) statistician and latex user, I'm interested in using R to produce AUTOMAGICALLY tables in latex format. I mean I would like to have the means to build an R procedure generating **FROM INSIDE** a table or a graph to be inserted directly into latex. I've read http://hesweb1.med.virginia.edu/biostat/s/doc/summary.pdf where the author speaks of S (not R) and Latex integration via a Hmisc library which allows to make automatic, calculated tables in latex. Unfortunately this library doesn't seem to be present in R (I tried to follow the example issuing a library(Hmisc) and then, plainly, library() but nothing with the same functions appeared). Any help on how to set up that integration? And, where can I find documentation/examples on that? A Google Groups search matches many postings, e.g. this one [EMAIL PROTECTED]: I don't know how well gnuplot integrates with LaTeX, but R certainly does. If you use the Sweave-package (delivered by default with R), you can put your R code right into your LaTeX document. Process your document once with R and then with LaTeX and that's it: a nice paper with the results of your analyses. If you _really_ want to speed up things, you can use R from within your favorite emacs editor (install ESS mode, i.e. emacs speaks statistics). At the moment I don't have any further information because I'm also at the beginning of integrating R into LaTeX. But from the german newsgroup de.comp.text.tex I know, that it's possible and even easy. Reading the following document was suggested to me: http://www.ci.tuwien.ac.at/~leisch/Sweave/Sweave-manual-20020507.pdf And LaTeX-tables could really be done with library(hmisc). Maybe you have to install the hmisc-package. It isn't yet in my machine, too. How to install a package describes the FAQ (http://cran.r-project.org/doc/FAQ/R-FAQ.html): 5.2 How can add-on packages be installed? HTH Greetings, Christoph -- Christoph Bier, Dipl.Oecotroph., Email: [EMAIL PROTECTED] Universitaet Kassel, FG Oekologische Lebensmittelqualitaet und Ernaehrungskultur \\ Postfach 12 52 \\ 37202 Witzenhausen Tel.: +49 (0) 55 42 / 98 -17 21, Fax: -17 13 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Integration between R latex
Hi! Most probably you did not install Hmisc on your system. It is not included in R-base. You find it on CRAN. (cran.r-project.org - source for contributed packages) After installing it for your system the examples may well work. Have a nice sunday, detlef On Sun, 12 Oct 2003 09:19:12 +0200 [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: As an R absolute beginner and an expert (very old) statistician and latex user, I'm interested in using R to produce AUTOMAGICALLY tables in latex format. I mean I would like to have the means to build an R procedure generating **FROM INSIDE** a table or a graph to be inserted directly into latex. I've read http://hesweb1.med.virginia.edu/biostat/s/doc/summary.pdf where the author speaks of S (not R) and Latex integration via a Hmisc library which allows to make automatic, calculated tables in latex. Unfortunately this library doesn't seem to be present in R (I tried to follow the example issuing a library(Hmisc) and then, plainly, library() but nothing with the same functions appeared). Any help on how to set up that integration? And, where can I find documentation/examples on that? Thanks Vittorio __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- The whole problem with the world is that fools and fanatics are always so certain of themselves, but wiser people so full of doubts. Russell Detlef Steuer --- http://fawn.unibw-hamburg.de/steuer.html * Encrypted mail preferred * __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Integration between R latex
Detlef Steuer schrieb: Hi! Most probably you did not install Hmisc on your system. It is not included in R-base. You find it on CRAN. (cran.r-project.org - source for contributed packages) After installing it for your system the examples may well work. Hi, i just tried to install Hmisc with install.packages(Hmisc,installWithVers = true) but get the following error: Error in unique(pkgs) : Object Hmisc not found It searches in http://cran.r-project.org/src/contrib/PACKAGES where Hmisc *is* listed. Did *I* make a mistake or is there something else wrong? Greetings, Christoph -- Christoph Bier, Dipl.Oecotroph., Email: [EMAIL PROTECTED] Universitaet Kassel, FG Oekologische Lebensmittelqualitaet und Ernaehrungskultur \\ Postfach 12 52 \\ 37202 Witzenhausen Tel.: +49 (0) 55 42 / 98 -17 21, Fax: -17 13 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Integration between R latex
Christoph Bier [EMAIL PROTECTED] wrote: i just tried to install Hmisc with install.packages(Hmisc,installWithVers = true) but get the following error: Error in unique(pkgs) : Object Hmisc not found It searches in http://cran.r-project.org/src/contrib/PACKAGES where Hmisc *is* listed. Did *I* make a mistake or is there something else wrong? You may need to quote the Hmisc object's name: install.packages(Hmisc) -- Philippe __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Integration between R latex
Philippe Glaziou schrieb: [...] You may need to quote the Hmisc object's name: install.packages(Hmisc) Yes, that's it -- nearly: I had also to quote installWithVers = true. Thanks! Greetings, Christoph -- Christoph Bier, Dipl.Oecotroph., Email: [EMAIL PROTECTED] Universitaet Kassel, FG Oekologische Lebensmittelqualitaet und Ernaehrungskultur \\ Postfach 12 52 \\ 37202 Witzenhausen Tel.: +49 (0) 55 42 / 98 -17 21, Fax: -17 13 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Integration between R latex
On Sun, 12 Oct 2003, Philippe Glaziou wrote: Christoph Bier [EMAIL PROTECTED] wrote: i just tried to install Hmisc with install.packages(Hmisc,installWithVers = true) but get the following error: Error in unique(pkgs) : Object Hmisc not found It searches in http://cran.r-project.org/src/contrib/PACKAGES where Hmisc *is* listed. Did *I* make a mistake or is there something else wrong? You may need to quote the Hmisc object's name: install.packages(Hmisc) I also suggest leaving out installWithVers = true (which should be TRUE or FALSE) until you need it (unlikely any time soon). -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] stepAIC problem
At 09:46 05-10-2003, Hiroto Miyoshi wrote: Dear R-users I have a probelm running stepAIC in R1.7.1 (...) --small example library(MASS) x1-runif(100) x2-runif(100) x3-runif(100) x4-runif(100) x5-runif(100) y-x1+x2+x3+runif(100) t-data.frame(y=y,x1=x1,x2=x2,x3=x3,x4=x4,x5=x5) x-lm(y~x1+x2+x3+x4+x5,data=t) stepAIC(x) Start: AIC= -247.61 y ~ x1 + x2 + x3 + x4 + x5 Df Sum of Sq RSS AIC - x51 3.747e-067.456 -249.608 - x41 0.0267.483 -249.254 none 7.456 -247.609 - x11 4.866 12.322 -199.375 - x21 8.182 15.639 -175.543 - x31 8.597 16.054 -172.922 Error in as.data.frame.default(data) : can't coerce function into a data.frame Hiroto, In My computer with R 1.7.1 e R 1.8.0 (win 98 SE) donĀ“t have this error... []s Tura __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Integration between R latex
Prof Brian Ripley schrieb: On Sun, 12 Oct 2003, Christoph Bier wrote: [...] Ok, I'll keep that in mind. But may I ask why you suggest leaving it out? That's the wrong question: you need to say why you intend to include it. Givne that you don't know the difference between true and TRUE, I guess you are a naive R user and this would be a needless complication. (Maybe 0.1% of R users make use it.) Yes, I'm a quite new R user and yet I don't know the difference between true and TRUE. But I read on the manuals. Greetings, Christoph -- Christoph Bier, Dipl.Oecotroph., Email: [EMAIL PROTECTED] Universitaet Kassel, FG Oekologische Lebensmittelqualitaet und Ernaehrungskultur \\ Postfach 12 52 \\ 37202 Witzenhausen Tel.: +49 (0) 55 42 / 98 -17 21, Fax: -17 13 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Integration between R latex
Whoops. Should be courses, not course, below. See also http://www.analytics.washington.edu/~rossini/course/cph-statcomp/ and lab 2, for a walk-through example (with sample files) of using Sweave (both figures and tables get included). [EMAIL PROTECTED] [EMAIL PROTECTED] writes: As an R absolute beginner and an expert (very old) statistician and latex user, I'm interested in using R to produce AUTOMAGICALLY tables in latex format. I mean I would like to have the means to build an R procedure generating **FROM INSIDE** a table or a graph to be inserted directly into latex. I've read http://hesweb1.med.virginia.edu/biostat/s/doc/summary.pdf where the author speaks of S (not R) and Latex integration via a Hmisc library which allows to make automatic, calculated tables in latex. Unfortunately this library doesn't seem to be present in R (I tried to follow the example issuing a library(Hmisc) and then, plainly, library() but nothing with the same functions appeared). Any help on how to set up that integration? And, where can I find documentation/examples on that? Thanks Vittorio __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- [EMAIL PROTECTED]http://www.analytics.washington.edu/ Biomedical and Health Informatics University of Washington Biostatistics, SCHARP/HVTN Fred Hutchinson Cancer Research Center UW (Tu/Th/F): 206-616-7630 FAX=206-543-3461 | Voicemail is unreliable FHCRC (M/W): 206-667-7025 FAX=206-667-4812 | use Email CONFIDENTIALITY NOTICE: This e-mail message and any attachme...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Automatic re-looping after error
On 12-Oct-03 Andy Liaw wrote: It's in R-1.8.0, released October 8th. On 09-Oct-03 Thomas Lumley wrote: On Thu, 9 Oct 2003 [EMAIL PROTECTED] wrote: All that's really needed to cope with the situation is for R to drop that cycle of the loop, and resume with a new cycle. However, I'm wondering how to set this up. I've had a look at try(), and I'm not at all sure that it does what I would want. What I'd really like is something (inside the loop) on the lines of on.error(maybe some parameters X) break where X might specify what sort of error or what function it comes from. Would setting options(error = break ) I don't think so. You may need to look at the new exception-handling code (start with help(tryCatch)). I've now installed R-1.8.0 which does include 'tryCatch' and related things, but from the look of it I'll have to study it a bit before I see how it all works! Meanwhile, thanks to others (Spencer Graves, Achim Zeileis, as well as Thomas Lumley and Andy Liaw) for suggestions. Though I'd already looked at try, I thought I'd have another go. It turns out I'd been muddled about testing the result of 'try' in the right way. In fact, if 'myfun(...)' might fail in a loop, then result - try(myfun(...)); if(class(result)==try-error) next ; will have the effect of breaking out of the current cycle of the loop and starting a new cycle. Otherwise 'result' will be a valid returned value from 'myfun'. This is exactly what I had wanted. Thanks to all for the help! Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 167 1972 Date: 12-Oct-03 Time: 13:44:27 -- XFMail -- __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Rd problems --- followup
I should'nt have sent the last mail so fast. Same problem with \eqn{u_j = a_j + b x + c x^2, \quad j=1, \ldots, r-1} {u[j] = a[j] + b*x + c*x^2 j = 1,\dots,r-1} I thought the problem in the first case could have to do with the use use of \mbox{} (with the braces) within the arguments of \eqn, but here there are none braces in the arguments of \eqn{}{}. Another case giving the same problem is \eqn{(k(n-1))\times (k(n-1))} {( k*(n-1) ) X ( k*(n-1) )} Kjetil Halvorsen __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Rd problems
Hola! I have the following in a .Rd file: \eqn{\mbox{coef} = c(\mbox{coef}[1],\ldots, \mbox{coef}[n]) } {coef = c(coef[1], coef[2], \dots, coef[n])} However, both arguments come out in the latex file! Whats happening? Kjetil Halvorsen __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] R graphics + non-R langs
Hello, dear R experts! One of the first reasons I began to use R, was its beautiful plotting capabilities. I found them very nice and simple. But at the last time I consider another languages (Perl, Python) for coding my scientific applications. So for now, in order to plot graphics I have to write data to the disk, launch R separately, and run R script just to plot my data. I gave a glance at the other scientific plotting libraries (plplot, pgplot, dislin) - all of them support API of many languages. The question is: what about R graphics? Is it so hard to bind it with any non-R languages? Thank you! -- WBR, Timur V. Elzhov __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] R graphics + non-R langs
Timur Elzhov wrote: Hello, dear R experts! One of the first reasons I began to use R, was its beautiful plotting capabilities. I found them very nice and simple. But at the last time I consider another languages (Perl, Python) for coding my scientific applications. So for now, in order to plot graphics I have to write data to the disk, launch R separately, and run R script just to plot my data. I gave a glance at the other scientific plotting libraries (plplot, pgplot, dislin) - all of them support API of many languages. The question is: what about R graphics? Is it so hard to bind it with any non-R languages? You are looking for the the packages RSPython and RSPerl from the Omegahat project http://www.omegahat.org/ Uwe Ligges __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] R graphics + non-R langs
2003-10-12, v keltezssel Timur Elzhov ezt rta: at the last time I consider another languages (Perl, Python) for The question is: what about R graphics? Is it so hard to bind it with any non-R languages? Try RPy (R from Python)! http://rpy.sourceforge.net/ Gbor __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Automatic re-looping after error
On Sat, 11 Oct 2003 [EMAIL PROTECTED] wrote: Thanks, Thomas. I don't seem to have anything related to this in R-1.7.1 (16/06/03). However, some web-searching finally tracked down http://stat.ethz.ch/R-manual/R-devel/library/base/html/conditions.html so what would be involved in making this stuff available? Upgrade to current R? Install a beta-version? Update to the current R. It was introduced in 1.8.0 -thomas __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Rd problems
I am running Rcmd check (Windows XP, rw1080 from cran) on a new package. This reports undocumented code objects for 14 functions, which all have their .Rd files! What might be happening? Kjetil Halvorsen __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Rd problems --- followup
I don't think you are allowed a line break in }{ : you certainly are not in other circumstances. Please try it without, as your example works for me without the (probably) illegal line break. On Sun, 12 Oct 2003 [EMAIL PROTECTED] wrote: I should'nt have sent the last mail so fast. Same problem with \eqn{u_j = a_j + b x + c x^2, \quad j=1, \ldots, r-1} {u[j] = a[j] + b*x + c*x^2 j = 1,\dots,r-1} I thought the problem in the first case could have to do with the use use of \mbox{} (with the braces) within the arguments of \eqn, but here there are none braces in the arguments of \eqn{}{}. Another case giving the same problem is \eqn{(k(n-1))\times (k(n-1))} {( k*(n-1) ) X ( k*(n-1) )} Kjetil Halvorsen -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Rd problems
[EMAIL PROTECTED] wrote: I am running Rcmd check (Windows XP, rw1080 from cran) on a new package. This reports undocumented code objects for 14 functions, which all have their .Rd files! What might be happening? 1) You forgot to set an \alias{} (most probable) 2) There is another error in the Rd files 3) There is a bug in R (less probable) At first check points 1-2) from above, after that repeat the complete output of Rcmd check and provide a minimal version of one of your Rd files which does not work. Uwe Ligges Kjetil Halvorsen __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Rd problems
Do the functions all have proper \alias entries? -roger [EMAIL PROTECTED] wrote: I am running Rcmd check (Windows XP, rw1080 from cran) on a new package. This reports undocumented code objects for 14 functions, which all have their .Rd files! What might be happening? Kjetil Halvorsen __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] evaluating R expressions from C
Iryna Lobach wrote: Hello! I've looked at R help and previous postings, but I am not sure I completely understand the mechanism of evaluating R expressions from C++. C or C++ (the latter is a bit more tricky)? Have you read the manual Writing R Extensions? They have function SEXP eval(SEXP expr, SEXP rho), but I can't get it to work. Could anyone who used it give any comments on how efficient it is and, if possible, give example of how to use it. My main problem is that I don't really understand how pass the name of R-function and it's parameters. See Section 4.9, Evaluating R expressions from C, of the manual Writing R Extension. There is an example just after the line you gave above. Re efficiency: In most circumstances it is faster than in R itself (if not, nobody would like to do it in C!). As always, it depends on your problem ... Uwe Ligges Thank you, Iryna __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Subclassing lm
[EMAIL PROTECTED] wrote: I'd trying to subclass the lm class to produce a mylm class whose instances behave like lm objects (are accepted by methods like summary.lm) but have additional data or slots of my own design. For starters: setClass(mylm, lm) produces the somewhat cryptic: Warning message: Old-style (``S3'') class mylm supplied as a superclass of mylm, but no automatic conversion will be peformed for S3 classes in: .validDataPartClass(cl, name) What does this imply? I've never mixed S3 and S4 methods, so excuse my ignorance here (and I'm only answering because I haven't seen another reply). Since there is no formal definition of a representation of lm (an S3 class!): Does it really make sense for you to extend it with S4 methods? If not, I'd rather use the old construct to tell the object about inheritance: class(anymylmobject) - c(mylm, lm) Anyway, what you are looking for is ?setOldClass in my expectation, as in: setOldClass(c(mylm, lm)) Reading that help file carefully might help. In particular, you can get a bit of S4 behaviour (e.g. you can defining S4 Classes and Methods), but you'll just get a virtual class, so the requested definition of formal slots will be still a problem. Uwe Ligges __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] plot/ layout/ overlay problem
System info: Red Hat 9.0 R Version 1.7.0 ESS 5.1.21 Emacs 21.2.1 --- Colleagues I have a small problem with positioning overlays using layout. ## Purpose: to plot temperature and salinity profiles ## as a multipanel figure, and ## overlay the the mixed ## layer depths. Here is the code skeleton: nf - layout(matrix(c(1,2,3,4,5,6,7,8,9,10,11, 12,13,14,15,16,17,18,19,20,21,22), 2,11,byrow=TRUE)) par.old - par(mai=c(1,0.5,1,0)) for (i in 1:22){ ## plot temperature profiles (solid line) plot(... ## plot sigma t profiles (dashed line) par(new=TRUE) plot( ... } ## overlay the mixed layer depths nf - layout(matrix(c(1,2), 2,1,byrow=TRUE)) par(new=TRUE) test.x - c(0,1,2,3,4,5,6,7,8,9,10,11) test.y - c(90,100,110,200,200,250,300,350,330,370,330,370) plot(test.x,test.y, ylim=c(1000,0), xlim=c(0,11),type='b', axes=F,lty=3) par(par.old) --- The problem is that the second overlay comes up in the bottom panel (where the last of the 22 panels ended). The question is: how do I get the second overlay to start in the top panel where the first of the 22 panels began? Best fishes Sam -- Sam McClatchie, Research scientist (fisheries acoustics)) NIWA (National Institute of Water Atmospheric Research Ltd) PO Box 14 901, Kilbirnie, Wellington, New Zealand [EMAIL PROTECTED] Research home page http://www.smcc.150m.com/ /\ xX( /// \\\ /// %)Xx / \\ (((@ (((% ..xX(?O?)Xx __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] plot/ layout/ overlay problem
Hi Sam McClatchie wrote: System info: Red Hat 9.0 R Version 1.7.0 ESS 5.1.21 Emacs 21.2.1 --- Colleagues I have a small problem with positioning overlays using layout. ## Purpose: to plot temperature and salinity profiles ## as a multipanel figure, and ## overlay the the mixed ## layer depths. Here is the code skeleton: nf - layout(matrix(c(1,2,3,4,5,6,7,8,9,10,11, 12,13,14,15,16,17,18,19,20,21,22), 2,11,byrow=TRUE)) par.old - par(mai=c(1,0.5,1,0)) for (i in 1:22){ ## plot temperature profiles (solid line) plot(... ## plot sigma t profiles (dashed line) par(new=TRUE) plot( ... } ## overlay the mixed layer depths nf - layout(matrix(c(1,2), 2,1,byrow=TRUE)) par(new=TRUE) test.x - c(0,1,2,3,4,5,6,7,8,9,10,11) test.y - c(90,100,110,200,200,250,300,350,330,370,330,370) plot(test.x,test.y, ylim=c(1000,0), xlim=c(0,11),type='b', axes=F,lty=3) par(par.old) --- The problem is that the second overlay comes up in the bottom panel (where the last of the 22 panels ended). The question is: how do I get the second overlay to start in the top panel where the first of the 22 panels began? The problem is that when you try to do your second overlay you do not end up calling plot.new() so it does not move to the next plotting region. After the layout() call you are actually sitting in the last layout plotting region (number 2 in this case -- this is done so that the next plot.new() call will wrap to the first plotting region). This is why you end up drawing in the bottom panel. A very nasty hack to get what you want is to change your layout so that the last plotting region is actually the one you want, as follows ... nf - layout(matrix(c(2,1), 2,1,byrow=TRUE)) That is a very nasty way to do it, plus I wonder how well your second overlay lines up with the individual plots(?). I think we could achieve something much nicer using some of grid's features (there is now a package called gridBase on CRAN for combining grid with base plots). I would be very interested to hear more about what you are trying to do and would like to help achieve it -- please contact me directly if you are interested. Paul -- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 [EMAIL PROTECTED] http://www.stat.auckland.ac.nz/~paul/ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] how to seperate R's input and output screen?
Dear all can anybady tell me how to seperate R's input and output screen?I mean just like SAS or some others, the commands does not mixed with results. thank you __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Use of outer
Dear list, I have been trying to use the function outer to make contour plots of a cost function for regression analysis with no success. (see commented code below). Could anybody give me some advice on what I am doing wrong, or what is relevant for me to read? Thanks, Rafael ## = CODE ## Create vectors and matrix Y - c(0.5116403,2.4055245,1.6596707,1.8286057,2.6119199) col.1 - c(0.8997692,0.8216292,0.6449104,0.8179743,0.6602276) col.2 - c(0.01175669,0.89389797,0.19913807,0.29872301,0.66144258) X - cbind(col.1, col.2) ## Define function ## Give default values so that it takes two arguments J - function (x1, x2, X.val=X, Y.val=Y) { t(Y.val-X.val[,1]*x1-X.val[,2]*x2) %*% (Y.val-X.val[,1]*x1-X.val[,2]*x2) } ## Get grid to plot theta.1 - array(seq(-1, 1, length=10)) theta.2 - theta.1 ## How to do this with outer? z.matrix - outer(theta.1, theta.2, J) ## Plot contour(theta.1, theta.2, z.matrix) __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] regression
After calling function lm one can use the as.matrix function on anova to get the numbers out of an analysis of variance table and output latex code for a nicely formatted table. I would like to do a similar thing with regression coefficients, standard errors, and p-values, etc. I have not been able to. Is it possible? David Allen __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Use of outer
I get var(as.vector(z.matrix)) [1] 0 I got sensible results from the following: z.matrix - outer(theta.1, theta.2, +) ## Plot contour(theta.1, theta.2, z.matrix) hope this helps. spencer graves Rafael Jimenez wrote: Dear list, I have been trying to use the function outer to make contour plots of a cost function for regression analysis with no success. (see commented code below). Could anybody give me some advice on what I am doing wrong, or what is relevant for me to read? Thanks, Rafael ## = CODE ## Create vectors and matrix Y - c(0.5116403,2.4055245,1.6596707,1.8286057,2.6119199) col.1 - c(0.8997692,0.8216292,0.6449104,0.8179743,0.6602276) col.2 - c(0.01175669,0.89389797,0.19913807,0.29872301,0.66144258) X - cbind(col.1, col.2) ## Define function ## Give default values so that it takes two arguments J - function (x1, x2, X.val=X, Y.val=Y) { t(Y.val-X.val[,1]*x1-X.val[,2]*x2) %*% (Y.val-X.val[,1]*x1-X.val[,2]*x2) } ## Get grid to plot theta.1 - array(seq(-1, 1, length=10)) theta.2 - theta.1 ## How to do this with outer? z.matrix - outer(theta.1, theta.2, J) ## Plot contour(theta.1, theta.2, z.matrix) __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] regression
It can help you and help us if you provide a toy example that illustrates the problem. Consider the following: df1 - data.frame(x=1:6, y=rep(1:3, 2)) fit - lm(y~x, df1) In previous consideration of problems of this nature, I learned to consider summary and attributes(summary(fit)): : Sum - summary(fit) attributes(Sum) $names [1] call terms residuals coefficients [5] sigma dfr.squared adj.r.squared [9] fstatisticcov.unscaled After trying several things, I discovered the following: as.matrix(coefficients(Sum)) Estimate Std. Error t value Pr(|t|) (Intercept) 1.200 0.8176622 1.467599 0.2161194 x 0.2285714 0.2099563 1.088662 0.3375019 Does this answer your question? spencer graves David Allen wrote: After calling function lm one can use the as.matrix function on anova to get the numbers out of an analysis of variance table and output latex code for a nicely formatted table. I would like to do a similar thing with regression coefficients, standard errors, and p-values, etc. I have not been able to. Is it possible? David Allen __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Use of outer
On Sun, 12 Oct 2003, Spencer Graves wrote: I get var(as.vector(z.matrix)) [1] 0 I got sensible results from the following: z.matrix - outer(theta.1, theta.2, +) ## Plot contour(theta.1, theta.2, z.matrix) hope this helps. spencer graves Thanks for the pointer. A constant matrix is obtained with my call to 'outer'. However, the call to outer seems to work fine when a function that takes two arguments only is used. I guess the problem is in my definition of the function 'J', which depends on four arguments, but I couldn't figure out how to make it work. -Rafael [...] ## = CODE ## Create vectors and matrix Y - c(0.5116403,2.4055245,1.6596707,1.8286057,2.6119199) col.1 - c(0.8997692,0.8216292,0.6449104,0.8179743,0.6602276) col.2 - c(0.01175669,0.89389797,0.19913807,0.29872301,0.66144258) X - cbind(col.1, col.2) ## Define function ## Give default values so that it takes two arguments J - function (x1, x2, X.val=X, Y.val=Y) { t(Y.val-X.val[,1]*x1-X.val[,2]*x2) %*% (Y.val-X.val[,1]*x1-X.val[,2]*x2) } ## Get grid to plot theta.1 - array(seq(-1, 1, length=10)) theta.2 - theta.1 ## How to do this with outer? z.matrix - outer(theta.1, theta.2, J) ## Plot contour(theta.1, theta.2, z.matrix) __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help