Re: [R] predict.prcomp: 'newdata' does not have the correct number of columns
This is not to do with 'wide' matrices' but to do with the lack of column names. There is a bug -- the definition of 'p' should have NROW and not NCOL. On Sun, 18 May 2008, Gad Abraham wrote: Hi, I'm doing PCA on wide matrices and I don't understand why calling predict.prcomp on it throws an error: x1 - matrix(rnorm(100), 5, 20) x2 - matrix(rnorm(100), 5, 20) p - prcomp(x1) predict(p, x2) Error in predict.prcomp(p, x2) : 'newdata' does not have the correct number of columns dim(x2) [1] 5 20 dim(p$rotation) [1] 20 5 All predict.prcomp really does is x2 %*% p$rotation, which is a perfectly legal operation that should yield a 5x5 matrix: dim(x2 %*% p$rotation) [1] 5 5 Thanks, Gad -- Gad Abraham Dept. CSSE and NICTA The University of Melbourne Parkville 3010, Victoria, Australia email: [EMAIL PROTECTED] web: http://www.csse.unimelb.edu.au/~gabraham __ R-help@r-project.org 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. -- 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 __ R-help@r-project.org 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.
[R] plot a function with a vector as argument
I tried to define a function using another function I defined before, and the previous function has a vector as an argument, when I tried to get the graph of the new function, there was something going wrong. Here is a simple example to explain how it happend: fr1 - function(x,y){ x^2+x*y+1 } fr2 - function(x){ fr1(x,3) } plot(fr2) In this case, it worked just fine. But when I changed it to the following form: Fr1 - function(x){ x1 - x[1] x2 - x[2] x1^2+x1*x2+1 } Fr2 - function(x){ Fr1(c(x,3)) } plot(Fr2) it gives: Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' and 'y' lengths differ Could anyone help me with this problem? Thanks. -- View this message in context: http://www.nabble.com/plot-a-function-with-a-vector-as-argument-tp17299015p17299015.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Question about graphical UI running R version 2.7.0 (2008-04-22) on Ubuntu Hardy Heron...
Original Message Subject: Re: [R] Question about graphical UI running R version 2.7.0 (2008-04-22) on Ubuntu Hardy Heron... From: Scionforbai [EMAIL PROTECTED] To: Brian Lunergan [EMAIL PROTECTED] Date: 17.05.2008 23:07 Have a look at RKWard (http://rkward.sourceforge.net/), for kde. I don't know though if Ubuntu has it in its repos. rkward is great. It is in the ubuntu repos although usually not the recent versions. If you want to try those there are *.deb files on the already mentioned sourceforge page. Stefan __ R-help@r-project.org 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] predict.prcomp: 'newdata' does not have the correct number of columns
Prof Brian Ripley wrote: This is not to do with 'wide' matrices' but to do with the lack of column names. There is a bug -- the definition of 'p' should have NROW and not NCOL. On Sun, 18 May 2008, Gad Abraham wrote: I've submitted a bug report: predict.prcomp: wrong check for matrix dimensions (PR#11482) -- Gad Abraham Dept. CSSE and NICTA The University of Melbourne Parkville 3010, Victoria, Australia email: [EMAIL PROTECTED] web: http://www.csse.unimelb.edu.au/~gabraham __ R-help@r-project.org 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.
[R] plot(summary) within quantreg package
Quantreg package allows to plot the summary of models derived by quantile regression at different taus. The plot shows the parameters variation by varying taus: intercept and slope (for a linear model). Together with these values even confidence intervals may be plotted, based on the threshold given within the summary (e.g. alpha=0.01 equals 99% CI). However the graphic even plots the mean of all the values as a red line together with CI. I would like to remove such a useless information from the graphic. Here the main code: model- rq(y~x,data=dataset, tau = 0.8:10/10) # here is the model model.summary- summary(model) plot(sfm) # this function plots the summary parameters together with a red line I would like to remove Any help appreciated Duccio __ R-help@r-project.org 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] reading and analyzing a text file
ATF 1.0 205 Type=Mapix Results 2 DateTime=2008/05/15 11:05:38 ConfigFile= GalFile=Y:\experimental\090508\_v1.0.gal PixelSize=20 Wavelengths=635 532 ImageFiles=Y:\May_2008\B_1.0_090508\Images\B_1.0_090508_50.tif RatioFormulations=W1/W2 (635/532) FeatureType=Circular Barcode=0581 BackgroundSubtraction=LocalFeature ImageOrigin=2110, 5479 Creator=Mapix 3.0.0 (driver 1.0.25) Scanner=is700 7A02C1 706008 Temperature=26.3 Comment= LaserPower=5.0 5.0 SoftwareVersion=3.5.0.1 NameF532 Median B532 Median F635 Median B635 Median V001O01 4964.0 125.0 220.0 112.0 V001O01 5340.5 122.0 240.5 95.0 V001O02 5536.0 117.0 273.0 122.0 V001O02 5800.5 115.0 285.5 108.0 V001O03 3201.0 131.0 226.0 122.0 ... Looks like a gpr file to me. Yes, you can read that using te skip parameter and read.table. But most likely you want to have a look at the wealth of options in bioconductor - e.g. read.maimages() from limma or read.GenePix() from marray. cu Philipp -- Dr. Philipp Pagel Lehrstuhl für Genomorientierte Bioinformatik Technische Universität München Wissenschaftszentrum Weihenstephan 85350 Freising, Germany and Institut für Bioinformatik und Systembiologie / MIPS Helmholtz Zentrum München - Deutsches Forschungszentrum für Gesundheit und Umwelt Ingolstädter Landstrasse 1 85764 Neuherberg, Germany http://mips.gsf.de/staff/pagel __ R-help@r-project.org 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] plot a function with a vector as argument
In the call to the function 'fr1', the argument 'x' comes in as a vector and you get a vector result. Here is what it looks like: fr2(seq(0,1,.1)) [1] 1.00 1.31 1.64 1.99 2.36 2.75 3.16 3.59 4.04 4.51 5.00 because fr2 is sending a vector of length 10 to fr1 which will return a vector of length 10. When plotting a function, it will generate (by default) values 0 to 1, like above, and call for the plot of 10 'y' and 10 'x' values. Now lets take a look at your second set of functions. Fr2 - function(x){ Fr1(c(x,3)) } This will call Fr1 with a vector that is the concatenation of 'x' and 3. In the plot, you will get a sequence of: c(0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1,3) This is probably what you are not expecting since x[1] = 0 x[2] = .1 and you get just a single value returned: Fr2(seq(0,1,.1)) [1] 1 Now what you probably want is a 'list' for the parameters: Fr1 - function(x){ x1 - x[[1]] x2 - x[[2]] x1^2+x1*x2+1 } Fr2 - function(x){ Fr1(list(x,3)) } plot(Fr2) Fr2(seq(0,1,0.1)) [1] 1.00 1.31 1.64 1.99 2.36 2.75 3.16 3.59 4.04 4.51 5.00 On Sat, May 17, 2008 at 11:54 PM, chaij [EMAIL PROTECTED] wrote: I tried to define a function using another function I defined before, and the previous function has a vector as an argument, when I tried to get the graph of the new function, there was something going wrong. Here is a simple example to explain how it happend: fr1 - function(x,y){ x^2+x*y+1 } fr2 - function(x){ fr1(x,3) } plot(fr2) In this case, it worked just fine. But when I changed it to the following form: Fr1 - function(x){ x1 - x[1] x2 - x[2] x1^2+x1*x2+1 } Fr2 - function(x){ Fr1(c(x,3)) } plot(Fr2) it gives: Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' and 'y' lengths differ Could anyone help me with this problem? Thanks. -- View this message in context: http://www.nabble.com/plot-a-function-with-a-vector-as-argument-tp17299015p17299015.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? [[alternative HTML version deleted]] __ R-help@r-project.org 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] *apply function for arrays?
Hesen Peng wrote: Hi all, I've recently been writing functions which may deal with very large arrays. And I hope to use *apply functions in the program so that the code may look nicer and the performance may be better in the following two situations. The first situation is: I'm having an array A with dim(A)==c(m,n,p). And I want to apply a function F to a group of elements in A like: 1) F is applied to every group of elements like A[i,j,] for all i and j. or 2) F is applied to every group of elements like A[i,,] for all i, or A[,j,] for all j. Well, apply() itself does the job. Uwe Ligges The result is then expected to be a m*n-dimensional matrix I'm currently using for loops to do this but I guess there maybe some *apply functions for arrays which may accomplish this task. The second situation is: I'm having two matrix M and N and a function G, which is a function of two arrays. I want to form a matrix R with dim(R)==c(nrow(M),nrow(N)), and R[i,j] - G(M[i,], N[j,]). And I wonder whether I may use some functions like outer to the matrix. Thank you very much and have a nice weekend. __ R-help@r-project.org 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] plot(summary) within quantreg package
On Sun, 18 May 2008, [EMAIL PROTECTED] wrote: Quantreg package allows to plot the summary of models derived by quantile regression at different taus. The plot shows the parameters variation by varying taus: intercept and slope (for a linear model). Together with these values even confidence intervals may be plotted, based on the threshold given within the summary (e.g. alpha=0.01 equals 99% CI). However the graphic even plots the mean of all the values as a red line together with CI. I would like to remove such a useless information from the graphic. 1. It's not the mean of all values, it's the OLS coefficients with associated confidence bounds. 2. Be more polite. Not everyone will share your judgement that this information is useless. 3. Read the docs: Argument lcol can be used to modify the properties of the OLS lines, e.g. plot(sfm, lcol = transparent) Z Here the main code: model- rq(y~x,data=dataset, tau = 0.8:10/10) # here is the model model.summary- summary(model) plot(sfm) # this function plots the summary parameters together with a red line I would like to remove Any help appreciated Duccio __ R-help@r-project.org 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. __ R-help@r-project.org 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.
[R] opening multiple connections at once
Hi all, I'm new to R and I'm writing an R program that gets called on by a shell script. The shell script creates several directories with files, the names vary according to whatever I use as input to the shell script. I need to make connections to certain files in R (about 100 files in total). I have managed to either pass the directory paths or a list of all files in the directories into R. How can I make my R program open connections to all files in the directory or in the file list? I have searched the R-help archives and Google, but I can't seem to find an answer. Or at least no answers I can understand. Does anyone have a simple solution for me? Thanks in advance! Matje __ R-help@r-project.org 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] R 2.70 + ps2pdf14
thanks, berwin. yes, I meant ghostscript 8.62, of course. ps2pdf14 is the equivalent of a distiller and is needed to embed fonts. (R does not embed fonts itself afaik.) if someone knows another way to embed all the fonts, I would love to know so that I can avoid ps2pdf14 altogether (not just in this example, but generally; I use lucida fonts most of the time). if developers from the R graphics group are reading this, given that this strange output is not just my imagination, maybe it would be worthwhile to see if the R output pdf could be made more robust to avoid this feature. I stumbled onto it deep in a program, and spend an afternoon distilling it down to the R script that I posted. It was quite puzzling. PS: semicolons are a hobby, and one explicitly allowed by R. ;-). regards, /ivo On Sun, May 18, 2008 at 4:18 AM, Berwin A Turlach [EMAIL PROTECTED] wrote: G'day Ivo, On Sat, 17 May 2008 21:33:35 -0400 ivo welch [EMAIL PROTECTED] wrote: dear R graphics experts--- Not belonging to this group, but can confirm that I can see the same, in particular the circles are changing their size. However, I am a bit surprised that you run ps2pdf14 on a PDF file, according to the documentation the input should be a (E)PS file. if anyone is running the combination of R 2.7.0 and ghostscript (2.62), and I guess you mean ghostscript 8.62? Ghostscript 2.62 would be really ancient, probably from before the time that PDF was created... :) could you please run the following I will also leave it to somebody else on the list, specifically to people who find such coding particularly ugly if not offensive, to point out that semicolons are not needed at the end of lines of R scripts. :) HTH. Cheers, Berwin === Full address = Berwin A TurlachTel.: +65 6515 4416 (secr) Dept of Statistics and Applied Probability+65 6515 6650 (self) Faculty of Science FAX : +65 6872 3919 National University of Singapore 6 Science Drive 2, Blk S16, Level 7 e-mail: [EMAIL PROTECTED] Singapore 117546http://www.stat.nus.edu.sg/~statba __ R-help@r-project.org 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.
[R] R is a virus, spyware or malware (gasp!)
After a search session in Google, I found this page: http://www.prevx.com/filenames/X1993788672854780728-0/RGUI.EXE.html which classifies Rgui.exe (clearly stated as R for Windows GUI front-end) in a database of virus, spyware and malware! No comments! Philippe Grosjean __ R-help@r-project.org 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] R is a virus, spyware or malware (gasp!)
Of course it's a virus. Once you catch the virus, you feel this rush, this fever to abandon all other statistical packages. On a more serious note, though, the size of the RGUI.exe file as reported in the webpage is not even near close to the actual size of the R distribution exe pack. I On Sun, May 18, 2008 17:30, Philippe Grosjean wrote: After a search session in Google, I found this page: http://www.prevx.com/filenames/X1993788672854780728-0/RGUI.EXE.html which classifies Rgui.exe (clearly stated as R for Windows GUI front-end) in a database of virus, spyware and malware! No comments! Philippe Grosjean __ R-help@r-project.org 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. -- Ioannis C. Dimakos, Ph.D. University of Patras Department of Elementary Education Patras, GR-26500 GREECE http://www.elemedu.upatras.gr/dimakos/ __ R-help@r-project.org 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.
[R] Figure environment and includegraphics options from Sweave
Tha handy thinb about the fig=TRUE option in Sweave is that you do not have to bother about filenames and starting and stpping the device. I want the the resulting LaTeX to look as: \begin{Schunk} \begin{Sinput} x - seq(-2 * pi, 2 * pi, 0.1) plot(x, cos(x), type = l, lwd = 4) \end{Sinput} \end{Schunk} \begin{figure} \includegraphics[width=0.6\textwidth]{xx-001} \end{figure} i.e. with options to the \includegraphics and all embedded in a figure environment. 1) Is there a way to do this without writing the figure environment manually? 2) If not, is there a way to get the generated filename of the plot, or to explicitly give it in the .rnw file? The point of course being to avoid to start and stop the graphics driver explicitly? Best, Bendix Carstensen __ Bendix Carstensen Senior Statistician Steno Diabetes Center Niels Steensens Vej 2-4 DK-2820 Gentofte Denmark +45 44 43 87 38 (direct) +45 30 75 87 38 (mobile) [EMAIL PROTECTED] http://www.biostat.ku.dk/~bxc This e-mail (including any attachments) is intended for ...{{dropped:8}} __ R-help@r-project.org 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] Figure environment and includegraphics options from Sweave
On May 18, 2008, at 10:41 AM, BXC (Bendix Carstensen) wrote: Tha handy thinb about the fig=TRUE option in Sweave is that you do not have to bother about filenames and starting and stpping the device. I want the the resulting LaTeX to look as: \begin{Schunk} \begin{Sinput} x - seq(-2 * pi, 2 * pi, 0.1) plot(x, cos(x), type = l, lwd = 4) \end{Sinput} \end{Schunk} \begin{figure} \includegraphics[width=0.6\textwidth]{xx-001} \end{figure} i.e. with options to the \includegraphics and all embedded in a figure environment. 1) Is there a way to do this without writing the figure environment manually? The Sweave manual (section 4.1.2 in my version) suggests using something like this before the figure call: \setkeys{Gin}{width=0.6\textwidth} This sets the size globally. Not perfect, but it's what I've been doing. I would myself like the ability to add optional arguments to the produced \includegraphics call, but perhaps there is a good reason why this hasn't been implemented (other than that the developer might not have thought it useful/necessary, which is in itself a perfectly good reason why this feature is not there). 2) If not, is there a way to get the generated filename of the plot, or to explicitly give it in the .rnw file? The point of course being to avoid to start and stop the graphics driver explicitly? I haven't tried it, but perhaps if you have a named figure code chunk, this name is used for the file name? Best, Bendix Carstensen __ Bendix Carstensen Senior Statistician Steno Diabetes Center Niels Steensens Vej 2-4 DK-2820 Gentofte Denmark +45 44 43 87 38 (direct) +45 30 75 87 38 (mobile) [EMAIL PROTECTED] http://www.biostat.ku.dk/~bxc Haris Skiadas Department of Mathematics and Computer Science Hanover College __ R-help@r-project.org 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] opening multiple connections at once
See ?file -- all you need to do is to call that on every file you want to open. There is a limit to the number of simultaneously open connections, but it is currently more than 100. You haven't told us your OS (as requested in the posting guide), and you may hit OS/process limits. You have not told us what you actually want to do. It is very rare to need to open more than a few files simultaneously, so perhaps you need to rethink your program logic. Here is some code that opens all the tex files in a directory and lists all first lines and then all second lines: testit - function(dir) { files - list.files(dir, pattern=\\.tex$) cons - vector(list, length(files)) for(i in seq_along(files)) cons[[i]] - file(files[i], r) for(i in seq_along(cons)) print(readLines(cons[[i]], n=1)) for(i in seq_along(cons)) print(readLines(cons[[i]], n=1)) for(i in seq_along(cons)) close(cons[[i]]) } But there are better ways to tackle that problem (On unix-alikes you can set the per-process limits in the shell, and these days the limit on descriptors is usually 256 or more. On Windows R uses MSVCRT.DLL for which the documentation for _setmaxstdio says the default limit is 512. The current R limit on user-generated connections is about 124.) On Sun, 18 May 2008, Matje van de Camp wrote: Hi all, I'm new to R and I'm writing an R program that gets called on by a shell script. The shell script creates several directories with files, the names vary according to whatever I use as input to the shell script. I need to make connections to certain files in R (about 100 files in total). I have managed to either pass the directory paths or a list of all files in the directories into R. How can I make my R program open connections to all files in the directory or in the file list? I have searched the R-help archives and Google, but I can't seem to find an answer. Or at least no answers I can understand. Does anyone have a simple solution for me? But we don't know what you tried, nor what you want to do with the connection once opened, Thanks in advance! Matje -- 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 __ R-help@r-project.org 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] Figure environment and includegraphics options from Sweave
Thanks a lot yuor advice works, here is an actually working example of an .rnw file, where the graphs are stuffed in a subfolder: \documentclass{article} \begin{document} \SweaveOpts{include=FALSE} This is an experiment with two plots. Here is the first: CHUNK1, fig=TRUE, echo=TRUE, eps=FALSE, width=3, height=7, prefix.string=./graph/xx= x-seq(-2*pi, 2*pi, .1) plot(x, sin(x), type=l, lwd=4) @ And here is the second: TJUNK2, fig=TRUE, echo=TRUE, eps=FALSE, width=7, height=7, prefix.string=./graph/xx= x-seq(-2*pi, 2*pi, .1) plot(x, cos(x), type=l, lwd=4) @ The result should be two graphs side by side: \begin{figure}[h] \centering \includegraphics[width=0.27\textwidth]{./graph/xx-CHUNK1} \hfill \includegraphics[width=0.63\textwidth]{./graph/xx-TJUNK2} \caption{\it Here is the caption.} \label{fig:Tschunks1und2} \end{figure} \end{document} -Original Message- From: Charilaos Skiadas [mailto:[EMAIL PROTECTED] Sent: 18. maj 2008 17:08 To: BXC (Bendix Carstensen) Cc: r-help@r-project.org Subject: Re: [R] Figure environment and includegraphics options from Sweave On May 18, 2008, at 10:41 AM, BXC (Bendix Carstensen) wrote: Tha handy thinb about the fig=TRUE option in Sweave is that you do not have to bother about filenames and starting and stpping the device. I want the the resulting LaTeX to look as: \begin{Schunk} \begin{Sinput} x - seq(-2 * pi, 2 * pi, 0.1) plot(x, cos(x), type = l, lwd = 4) \end{Sinput} \end{Schunk} \begin{figure} \includegraphics[width=0.6\textwidth]{xx-001} \end{figure} i.e. with options to the \includegraphics and all embedded in a figure environment. 1) Is there a way to do this without writing the figure environment manually? The Sweave manual (section 4.1.2 in my version) suggests using something like this before the figure call: \setkeys{Gin}{width=0.6\textwidth} This sets the size globally. Not perfect, but it's what I've been doing. I would myself like the ability to add optional arguments to the produced \includegraphics call, but perhaps there is a good reason why this hasn't been implemented (other than that the developer might not have thought it useful/necessary, which is in itself a perfectly good reason why this feature is not there). 2) If not, is there a way to get the generated filename of the plot, or to explicitly give it in the .rnw file? The point of course being to avoid to start and stop the graphics driver explicitly? I haven't tried it, but perhaps if you have a named figure code chunk, this name is used for the file name? Best, Bendix Carstensen __ Bendix Carstensen Senior Statistician Steno Diabetes Center Niels Steensens Vej 2-4 DK-2820 Gentofte Denmark +45 44 43 87 38 (direct) +45 30 75 87 38 (mobile) [EMAIL PROTECTED] http://www.biostat.ku.dk/~bxc Haris Skiadas Department of Mathematics and Computer Science Hanover College __ R-help@r-project.org 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] R 2.70 + ps2pdf14
On Sat, 17 May 2008, ivo welch wrote: dear R graphics experts---if anyone is running the combination of R 2.7.0 and ghostscript (2.62), could you please run the following and let me know if you get the same strange symbol size that I do, or if there is something weird on my system?regards, /ivo How are you viewing the files? Problems with evince using an old poppler version (such as you get with Fedora 8) were reported recently, and seem to have been fixed with the newer version of poppler used in debian unstable. -- George N. White III [EMAIL PROTECTED] __ R-help@r-project.org 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] R 2.70 + ps2pdf14
if developers from the R graphics group are reading this, given that this strange output is not just my imagination, maybe it would be worthwhile to see if the R output pdf could be made more robust to avoid this feature. I stumbled onto it deep in a program, and spend an afternoon distilling it down to the R script that I posted. It was quite puzzling. Have you tried R-patched? I think Brian Ripley fixed this some days ago. Hadley -- http://had.co.nz/ __ R-help@r-project.org 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] autocorrelation error: cannot allocate vector of size 220979 Kb
Thanks. Here are some information about my computer and file: Operating system: Windows 2000 RAM: 1.99 GB After I run the program: gc() used (Mb) gc trigger (Mb) max used (Mb) Ncells 468065 12.5 818163 21.9 818163 21.9 Vcells 1160828 8.9 46162021 352.2 54869490 418.7 object.size(a) [1] 2144392 str(a) 'data.frame': 16925 obs. of 14 variables: $ Site : Factor w/ 6 levels HD,LEA,MCD,..: 6 6 6 6 6 6 6 6 6 6 ... $ Plot : num 1 1 1 1 1 1 1 1 1 1 ... $ Veg : Factor w/ 2 levels Forest,Grass: 2 2 2 2 2 2 2 2 2 2 ... $ Landuse : Factor w/ 2 levels Rural,Urban: 2 2 2 2 2 2 2 2 2 2 ... $ Date : Factor w/ 2484 levels 01-Apr-01,01-Apr-03,..: 1078 1162 1244 1326 1407 1488 1569 1650 1731 1812 ... $ Soil.temp : num 26.1 25.9 26.0 25.7 25.5 ... $ combin: Factor w/ 6 levels HDForestUrban,..: 6 6 6 6 6 6 6 6 6 6 ... $ year_scale: num -1.4 -1.4 -1.4 -1.4 -1.4 ... $ day : num 14 15 16 17 18 19 20 21 22 23 ... $ M : num 8 8 8 8 8 8 8 8 8 8 ... $ year : Factor w/ 8 levels 2000,2001,..: 4 4 4 4 4 4 4 4 4 4 ... $ combin2 : Factor w/ 11 levels HDForestUrban1,..: 10 10 10 10 10 10 10 10 10 10 ... $ time : num 225 226 227 228 229 230 231 232 233 234 ... $ time_scale: num 32.8 33.8 34.8 35.8 36.8 ... On Sat, May 17, 2008 at 5:04 PM, jim holtman [EMAIL PROTECTED] wrote: More information is needed. What is your operating system? How much RAM do you have? Are there other objects in memory that you could delete to recover some space? What does 'str' and 'object.size' say for the data you are analyzing? What does 'gc()' report - you may want to do this before/after sections of code to see how memory might be growing. On Fri, May 16, 2008 at 1:56 PM, J S [EMAIL PROTECTED] wrote: Dear R community, I used a linear mixed model (named lm11) to model daily soil temperature depending upon vegetation cover and air temperature. I have almost 17,000 observations for six years. I can not account for autocorrelation in my model, since I receive the error message after applying the function: update(lm11, corr=corAR1()) Error: cannot allocate vector of size 220979 Kb Do you have any suggestions? Thanks, Julia [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? [[alternative HTML version deleted]] __ R-help@r-project.org 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.
[R] how can i superpose 2 graphs
Hio i tried to do this by: par(new=TRUE) but the result is one picture but y-axis has 2 différent graduations.how can i correct this?( i want one graduation on y axis). -- View this message in context: http://www.nabble.com/how-can-i-superpose-2--graphs-tp17305355p17305355.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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 can i superpose 2 graphs
hanen hanen.mastouri at yahoo.fr writes: i tried to do this by: par(new=TRUE) but the result is one picture but y-axis has 2 différent graduations.how can i correct this?( i want one graduation on y axis). ?lines ?points Dieter __ R-help@r-project.org 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.
[R] cor -1
I'm having what looks like a quantization problem with cor on R 2.7.0. I get warnings from cor.test because r -1. R session output is at the bottom. A simple fix would be to add the appropriate checks to the end of the internal cor code. Oliver x - c(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0) y - c(1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1) cor.test(x, y) Pearson's product-moment correlation data: x and y t = NaN, df = 13, p-value = NA alternative hypothesis: true correlation is not equal to 0 95 percent confidence interval: NaN NaN sample estimates: cor -1 Warning messages: 1: In sqrt(1 - r^2) : NaNs produced 2: In atanh(r) : NaNs produced cor(x, y) -1 [1] TRUE cor(x, y) + 1 [1] -2.220446e-16 .Internal(cor(x, y, 1, FALSE)) -1 [1] TRUE .Internal(cor(x, y, 3, FALSE)) -1 [1] FALSE __ R-help@r-project.org 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.
[R] two curves at one graph
i try to use par(new=TRUE) i get them at the same graph but the y_axis and x_axis are drowen with two unevenly graduations that graph become unreadable. -- View this message in context: http://www.nabble.com/two-curves-at-one-graph-tp17307590p17307590.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] two curves at one graph
?lines ?points On 19/05/2008, at 8:44 AM, hanen wrote: i try to use par(new=TRUE) i get them at the same graph but the y_axis and x_axis are drowen with two unevenly graduations that graph become unreadable. -- View this message in context: http://www.nabble.com/two-curves-at- one-graph-tp17307590p17307590.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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. ## Attention:\ This e-mail message is privileged and confid...{{dropped:9}} __ R-help@r-project.org 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] two curves at one graph
plot(...) par(new=TRUE) plot(..., axes=FALSE, xlab='', ylab='') # prevent redraw of the axis axis(4) # add secondary y-axis on the right. On Sun, May 18, 2008 at 4:44 PM, hanen [EMAIL PROTECTED] wrote: i try to use par(new=TRUE) i get them at the same graph but the y_axis and x_axis are drowen with two unevenly graduations that graph become unreadable. -- View this message in context: http://www.nabble.com/two-curves-at-one-graph-tp17307590p17307590.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? [[alternative HTML version deleted]] __ R-help@r-project.org 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] R is a virus, spyware or malware (gasp!)
Ioannis Dimakos wrote: Of course it's a virus. Once you catch the virus, you feel this rush, this fever to abandon all other statistical packages. On a more serious note, though, the size of the RGUI.exe file as reported in the webpage is not even near close to the actual size of the R distribution exe pack. Hmm, the installed Rgui.exe in 2.7.0rc (which is all I have, under Wine on a Fedora machine) appears to be 27648 bytes, which is one of the cited numbers. Presumably something needs to be done... I On Sun, May 18, 2008 17:30, Philippe Grosjean wrote: After a search session in Google, I found this page: http://www.prevx.com/filenames/X1993788672854780728-0/RGUI.EXE.html which classifies Rgui.exe (clearly stated as R for Windows GUI front-end) in a database of virus, spyware and malware! No comments! Philippe Grosjean __ R-help@r-project.org 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. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@r-project.org 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.
[R] Opening more than 1 R console in Windows
Hi all, I recently found out that R does not utilize fully the Duo Core capability when you only run one instance of R. I did some number crunching today and it seems that if I only open 1 R console, it uses 50% of my CPU (either 50-50 or 100-0 on 2 cores). Then, I open the second instance and divide the work into two parts, and run them parallelly, they seems to utilize 100% of my CPU. So, my question would be that: is the computing result the same if I do them this way? Will there any mistake compared to running only one instance at a time? Thank you all. -- Regards, Anh Tran [[alternative HTML version deleted]] __ R-help@r-project.org 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] *apply function for arrays?
Hi, Thank you so much for the help. apply does work for the first situation. For the second situation, I'm currently using: temp.a-function(i,j){ return(G(M[i,],N[j,])) } temp.v-Vectorize(temp.a) result-outer(1:nrow(M),1:nrow(N),FUN=temp.v) And I wonder whether there are some other ways to do this. On Sun, May 18, 2008 at 3:52 PM, Patrick Burns [EMAIL PROTECTED] wrote: You want to use the 'apply' function. S Poetry has a chapter on higher dimensional arrays that may be of use to you. I don't see a good approach for your second situation other than a double for loop. Unless G is linear, I think all other solutions will be equivalent to a double for loop, though the loops may be hidden. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) Hesen Peng wrote: Hi all, I've recently been writing functions which may deal with very large arrays. And I hope to use *apply functions in the program so that the code may look nicer and the performance may be better in the following two situations. The first situation is: I'm having an array A with dim(A)==c(m,n,p). And I want to apply a function F to a group of elements in A like: 1) F is applied to every group of elements like A[i,j,] for all i and j. or 2) F is applied to every group of elements like A[i,,] for all i, or A[,j,] for all j. The result is then expected to be a m*n-dimensional matrix I'm currently using for loops to do this but I guess there maybe some *apply functions for arrays which may accomplish this task. The second situation is: I'm having two matrix M and N and a function G, which is a function of two arrays. I want to form a matrix R with dim(R)==c(nrow(M),nrow(N)), and R[i,j] - G(M[i,], N[j,]). And I wonder whether I may use some functions like outer to the matrix. Thank you very much and have a nice weekend. -- 彭河森 Hesen Peng http://hesen.peng.googlepages.com/ __ R-help@r-project.org 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] pch=. plots much faster
Le Tue, May 13, 2008 at 01:08:15PM +0100, Prof Brian Ripley a écrit : That is a function of your X setup. R does ask for backing store to be used, and so it seeems your setup is not doing so. Also, the type=cairo in X11() will repaint from a backing pixmap. Thanks for the answer. I have tried to add : Option BackingStore true in /etc/X11/xorg.conf, but it created many display artefacts. I understand why it was not on by default: it seems that not all graphic card drives support the option correctly. In the meantime, I have started to use a R installation that can make cairo graphics and I am very satisfied of it. (I also have tried to reduce the complexity of my plots, for instance by using the unique() function, that works very well with my highly redundant data). Have a nice day, -- Charles Plessy http://charles.plessy.org Wakō, Saitama, Japan __ R-help@r-project.org 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.
[R] three-dimensional (volumetric) estimation from x,y,z points
Dear all, I have a set of x,y,z points obtained from a lizard species and now I would like to estimate the three-dimensional use of space for this species. I know that 2D area I can estimate using adehabitat packages, but I don´t know how to estimate the volumetric space. Any help are welcome. Miltinho Brazil [[alternative HTML version deleted]] __ R-help@r-project.org 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.
[R] question for Logic Regression
Hi All: how to get the coefficient for logic regression using selection=2 ( fit multiple models) and type=3 ( logistic regression) for example i have a fit like below : fit-logreg(resp = model.dat[,21], bin=model.dat[, 2:18],sep=model.dat[,1] ,type=3,select=2,ntrees=2,nleaves=6 ,anneal.control=Annealing,tree.control=TreeControl) i try to use fit$coef but i get nothing. and i try to use eval.logreg to evaluate a validate data model.dat2, but i cannot fit model class make below formula work alltrees - eval.logreg(fit$model , model.dat2) could anyone enlighten me a little. thanks leo __ R-help@r-project.org 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] question for Logic Regression
try alltrees - predict(fit, model.dat2) # make sure response variable is not included in model.dat2 also to see the other attributes in fit, try: attributes(fit) thanks y coldeyes.Rhelp wrote: Hi All: how to get the coefficient for logic regression using selection=2 ( fit multiple models) and type=3 ( logistic regression) for example i have a fit like below : fit-logreg(resp = model.dat[,21], bin=model.dat[, 2:18],sep=model.dat[,1] ,type=3,select=2,ntrees=2,nleaves=6 ,anneal.control=Annealing,tree.control=TreeControl) i try to use fit$coef but i get nothing. and i try to use eval.logreg to evaluate a validate data model.dat2, but i cannot fit model class make below formula work alltrees - eval.logreg(fit$model , model.dat2) could anyone enlighten me a little. thanks leo __ R-help@r-project.org 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. - Yasir H. Kaheil Catchment Research Facility The University of Western Ontario -- View this message in context: http://www.nabble.com/question-for-Logic-Regression-tp17310610p17311081.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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.
[R] Balasan: Re: State disabled to Normal menu
Thank you very much for your advice,Jhon. I'm just trying to write some code. The logic of my code is if Model menu have been hit then Evaluation menu will active. I build the menus by tkadd, and try to change the state by tkconfigure, but it didn't work. May be i must catch the ID or the session of Model menu so that i can change the state of Evaluation menu. But i have no idea how to do that. Thank you. John Fox [EMAIL PROTECTED] wrote: Dear Handa, It's very difficult for me to tell from your message what it is you're trying to do. Are you simply a user of the Rcmdr, or are you trying to write a plug-in? If the former, Rcmdr menu items are disabled when they are for some reason inappropriate to the current context. For example, before there's an active data set, (almost) all of the statistical-analysis menu items are disabled; similarly, if your data set has no factors, then menus items for operations requiring factors, such as building contingency tables, are disabled. If the latter, the next-to-last field in each line of the menu-definition file is (optionally) a quoted logical expression: if the expression evaluates to TRUE, then the corresponding menu item is activated; if FALSE, it is not. For example, for the two-way contingency table menu item, the activation field is factorsP(2), which evaluates to TRUE if there are at least two factors in the active data set. I hope this helps, John On Sun, 18 May 2008 09:22:14 +0700 (ICT) Handayani Situmorang wrote: Hello all. is there a simple way to change the state of menu from disabled to normal? i have read from the Rcmdr code, but it's really difficult for me. I'm new for R. Thank you so much. Regard Handa - Yahoo! Toolbar kini dilengkapi dengan Search Assist. Download sekarang juga. [[alternative HTML version deleted]] __ R-help@r-project.org 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. John Fox, Professor Department of Sociology McMaster University Hamilton, Ontario, Canada http://socserv.mcmaster.ca/jfox/ - Yahoo! Toolbar kini dilengkapi dengan Search Assist. Download sekarang juga. [[alternative HTML version deleted]] __ R-help@r-project.org 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.