Re: [R] How to Plot Two Curves Into One Page
On Tue, 1 Feb 2011 14:20:51 +0900 Gundala Viswanath gunda...@gmail.com wrote: I have a R script that contain these lines for plotting: plot(foo,lwd=2,lty=3,col=red, main=); plot(bar,lwd=2,lty=3,col=blue); legend(0.6,0.6,c('Default','Probabilistic'), col=c('red','blue'),lwd=3); But it generate 1 file (Rplot.pdf) with two pages. Each page for 1 plot. Is there a way I can put them together in to one page? - G.V. Hello Gundala, If these are fairly simple plots (i.e. curve, points, bar, step) you can arrange your data as columns in a matrix and use matplot(). matplot(vectorOfxValues, FooBarAsMatrix, lwd=2, lty=3, col=c(red, blue)) legend(0.6,0.6,c('Default','Probabilistic'), col=c('red','blue'),lwd=3) Regards, Edwin -- Dr. Edwin Groot, postdoctoral associate AG Laux Institut fuer Biologie III Schaenzlestr. 1 79104 Freiburg, Deutschland +49 761-2032945 __ 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 to control ticks
On Tue, 21 Dec 2010 18:06:52 +0530 Yogesh Tiwari yogesh@googlemail.com wrote: Hi, I want 12 ticks at axis 1 and want to write Jan-Dec on each. something like: axis(1, at=1:12, labels=c('J','F','M','A','M','J','J','A','S','O','N','D')) I could omit default ticks but now how to control ticks. Dear Yogesh, I spray my clothing with No-Bite, and that controls ticks quite well. :-) Edwin plot(file$time, file$ch4*1000, ylim=c(1500,1700), xaxt='n', xlab= NA, ylab=NA,col=blue,yaxs=i,lwd=2, pch=10, type=b)# axis(1, at=1:12, labels=c('J','F','M','A','M','J','J','A','S','O','N','D')) BUT above is not working, and there is no error as well. Pls help, Regards, Yogesh [[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. Dr. Edwin Groot, postdoctoral associate AG Laux Institut fuer Biologie III Schaenzlestr. 1 79104 Freiburg, Deutschland +49 761-2032945 __ 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] Help Please!!!!!!!!!
On Sun, 28 Nov 2010 21:29:08 -0800 Melissa Waldman melissawald...@gmail.com wrote: Hi, I have been working with Program R for my stats class and I keep coming upon the same error, I have read so many sites about inputting data from a text file into R and I'm using the data to do a correspondence analysis. I feel like I have read everything and it is still not explaining why the error message keeps coming up, I have used the exact examples I have seen in articles and the same error keeps popping up: Error in sum(N) : invalid 'type' (character) of argument I have spent so long trying to figure this out without success, I am sure it has to do with the fact that my rows have names in them. I have attached the text file I have been using and if you have any ideas as to how I can get R to plot the data using correspondence analysis with the column and row names that would be really helpful! Or if you could pass this email to someone who may know how to help me, that would be much appreciated. Thank you, Melissa Waldman my email: melissawald...@gmail.com Hello Melissa, First of all, you need a descriptive subject, such as, Cannot read tabular data in R. R-help is a high-volume (100 to 200 messages per day) and each person that can help you is a specialist in one or another area. Secondly, please include in your mail an excerpt of the relevant code you used that read the data in and produced the error. From looking at your text file, I would delete the white space before None, save the file, and use the following function to read your data into a data.frame: read.delim(smokedata.txt) This assumes you used a tab character between each field. HTH, Edwin -- Dr. Edwin Groot, postdoctoral associate AG Laux Institut fuer Biologie III Schaenzlestr. 1 79104 Freiburg, Deutschland +49 761-2032945 __ 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] store matrix in an arrary
On Mon, 27 Sep 2010 11:12:26 +0100 wesley mathew wesleycmat...@gmail.com wrote: Dear All I want to store matrix in an array Suppose s-array(0,4) for(i in 1:4) s[i] - read_matrix(a,2,2) But the error - number of items to replace is not a multiple of replacement length. Can you suggest me any alternative method for storing a matrix in an array. Thanks In advance. Kind Regards Wesley C Mathew Wesley, I don't know what your read_matrix() function is doing. What you made is a 1-dimensional array of 4 elements. If your read_matrix() function returns more than one element per call, that is the source of your error message. It means you tried to store something in s[] that goes beyond its dimensions. Edwin __ 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. -- Dr. Edwin Groot, postdoctoral associate AG Laux Institut fuer Biologie III Schaenzlestr. 1 79104 Freiburg, Deutschland +49 761-2032945 __ 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] Tal Galili wants to stay in touch on LinkedIn
Tal: Invite everyone on R-Help, why not? Please check your contact e-mail address! Edwin -- On Mon, 20 Sep 2010 02:14:17 -0700 (PDT) Tal Galili via LinkedIn mem...@linkedin.com wrote: LinkedIn Tal Galili requested to add you as a connection on LinkedIn: -- Arnaud, I'd like to add you to my professional network on LinkedIn. - Tal Galili Accept invitation from Tal Galili http://www.linkedin.com/e/qi2mhu-geb4djy7-3w/qlt6CtWzi7sEoE_As_C0_wMfEZD2c-gGLFL6LO/blk/I2346598611_2/1BpC5vrmRLoRZcjkkZt5YCpnlOt3RApnhMpmdzgmhxrSNBszYOnP4NdzwVdjoQcP99bTxmq5tnjTkNbP4PcP4OdjsUdz4LrCBxbOYWrSlI/EML_comm_afe/ View invitation from Tal Galili http://www.linkedin.com/e/qi2mhu-geb4djy7-3w/qlt6CtWzi7sEoE_As_C0_wMfEZD2c-gGLFL6LO/blk/I2346598611_2/39vcj4Se3ARdzgPcAALqnpPbOYWrSlI/svi/ -- DID YOU KNOW that LinkedIn can find the answers to your most difficult questions? Post those vexing questions on LinkedIn Answers to tap into the knowledge of the world's foremost business experts: http://www.linkedin.com/e/qi2mhu-geb4djy7-3w/ask/inv-23/ -- (c) 2010, LinkedIn Corporation [[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. Dr. Edwin Groot, postdoctoral associate AG Laux Institut fuer Biologie III Schaenzlestr. 1 79104 Freiburg, Deutschland +49 761-2032945 __ 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] Multiple CPU HowTo in Linux?
Hello all, Thanks for your input, and helping to clear things up on where to go. I will try out the multicore package and see if there are further bottlenecks. It looks like some loops might need special treatment with parallelization. I have been pampered with the excellent walk-through vignettes of the packages I have used so far. The HPC package guides lacked something in the practical aspects of their usage. lapply - mclapply at the beginning of my script? Well, I never would have thought of such a thing. Thanks! I might be back on the list when I run out of physical RAM ;-) Edwin -- On Tue, 14 Sep 2010 12:11:17 -0700 Martin Morgan mtmor...@fhcrc.org wrote: On 09/14/2010 08:36 AM, Christian Raschke wrote: Edwin, I'm not sure what you mean by adapting; other than installing multicore, there is nothing else to set up. How and whether you could then parallelise your code strongly depends on the specific problem you are facing. What have done in the past was to look at the source of the functions from whatever package I was using that produced the bottleneck. If what is taking the longest time is actually embarrassingly parallel, mclapply() from package multicore can help. In the simplest case you could simply replace lapply() in the with an appropriate mclapply(). Check out ?mclapply. But then again you might have to get a little more creative, depending on exactly what in the code is taking so long to run. If your problem is inherently sequential then even multicore won't help. Christian On 09/14/2010 09:35 AM, Edwin Groot wrote: Hello Cedrick, Ah, yes, that looks like it would apply to my situation. I was previously reading on snow, which is tailored for clusters, rather than a single desktop computer. Anyone with experience adapting multicore to an R-script? I have to admit I know little about parallel processing, multiprocessing and cluster processing. Edwin On Tue, 14 Sep 2010 10:15:42 -0400 Johnson, Cedrick W.cedr...@cedrickjohnson.com wrote: ?multicore perhaps On 09/14/2010 10:01 AM, Edwin Groot wrote: Hello all, I upgraded my R workstation, and to my dismay, only one core appears to be used during intensive computation of a bioconductor function. Hi Edwin -- Since you have a Bioconductor package, you might ask on the Bioconductor list, as the authors of some computationally intensive tasks have provided facilities for relatively transparent use of, e.g., multicore or Rmpi. In ShortRead, for instance, loading multicore is enough to distribute some tasks across cores, and the srapply function can help (or not; things might be as easy as lapply - mclapply at the top of your script) with your own lapply-like code. http://bioconductor.org/help/mailing-list/ Martin What I have now is two dual-core Xeon 5160 CPUs and 10 GB RAM. When I fully load it, top reports about 25% user, 75% idle and 0.98 short-term load. The archives gave nothing helpful besides mention of snow. I thought of posting to HPC, but this system is fairly modest WRT processing power. Any pointers of where to start? --- #Not running anything at the moment sessionInfo() R version 2.11.1 (2010-05-31) x86_64-pc-linux-gnu locale: [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_GB.UTF-8LC_COLLATE=en_GB.UTF-8 [5] LC_MONETARY=C LC_MESSAGES=en_GB.UTF-8 [7] LC_PAPER=en_GB.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] tools_2.11.1 --- $ uname -a Linux laux29 2.6.26-2-amd64 #1 SMP Sun Jun 20 20:16:30 UTC 2010 x86_64 GNU/Linux --- Thanks for your help, Edwin __ 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. Dr. Edwin Groot, postdoctoral associate AG Laux Institut fuer Biologie III Schaenzlestr. 1 79104 Freiburg, Deutschland +49 761-2032945 __ 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
[R] Multiple CPU HowTo in Linux?
Hello all, I upgraded my R workstation, and to my dismay, only one core appears to be used during intensive computation of a bioconductor function. What I have now is two dual-core Xeon 5160 CPUs and 10 GB RAM. When I fully load it, top reports about 25% user, 75% idle and 0.98 short-term load. The archives gave nothing helpful besides mention of snow. I thought of posting to HPC, but this system is fairly modest WRT processing power. Any pointers of where to start? --- #Not running anything at the moment sessionInfo() R version 2.11.1 (2010-05-31) x86_64-pc-linux-gnu locale: [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_GB.UTF-8LC_COLLATE=en_GB.UTF-8 [5] LC_MONETARY=C LC_MESSAGES=en_GB.UTF-8 [7] LC_PAPER=en_GB.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] tools_2.11.1 --- $ uname -a Linux laux29 2.6.26-2-amd64 #1 SMP Sun Jun 20 20:16:30 UTC 2010 x86_64 GNU/Linux --- Thanks for your help, Edwin -- Dr. Edwin Groot, postdoctoral associate AG Laux Institut fuer Biologie III Schaenzlestr. 1 79104 Freiburg, Deutschland +49 761-2032945 __ 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] Multiple CPU HowTo in Linux?
Hello Cedrick, Ah, yes, that looks like it would apply to my situation. I was previously reading on snow, which is tailored for clusters, rather than a single desktop computer. Anyone with experience adapting multicore to an R-script? I have to admit I know little about parallel processing, multiprocessing and cluster processing. Edwin On Tue, 14 Sep 2010 10:15:42 -0400 Johnson, Cedrick W. cedr...@cedrickjohnson.com wrote: ?multicore perhaps On 09/14/2010 10:01 AM, Edwin Groot wrote: Hello all, I upgraded my R workstation, and to my dismay, only one core appears to be used during intensive computation of a bioconductor function. What I have now is two dual-core Xeon 5160 CPUs and 10 GB RAM. When I fully load it, top reports about 25% user, 75% idle and 0.98 short-term load. The archives gave nothing helpful besides mention of snow. I thought of posting to HPC, but this system is fairly modest WRT processing power. Any pointers of where to start? --- #Not running anything at the moment sessionInfo() R version 2.11.1 (2010-05-31) x86_64-pc-linux-gnu locale: [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_GB.UTF-8LC_COLLATE=en_GB.UTF-8 [5] LC_MONETARY=C LC_MESSAGES=en_GB.UTF-8 [7] LC_PAPER=en_GB.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] tools_2.11.1 --- $ uname -a Linux laux29 2.6.26-2-amd64 #1 SMP Sun Jun 20 20:16:30 UTC 2010 x86_64 GNU/Linux --- Thanks for your help, Edwin __ 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. Dr. Edwin Groot, postdoctoral associate AG Laux Institut fuer Biologie III Schaenzlestr. 1 79104 Freiburg, Deutschland +49 761-2032945 __ 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.