Re: [R] Problem with memory footprint of qq plot generated with lattice
Dave, qqmath(~val|ind,data=xx ,distribution=function(p) qt(p,df=19) ,ylab=Sample Quatinles ,xlab=Theoretical Quantiles ,aspect=1 ,prepanel = prepanel.qqmathline ,panel=function(x,y) { panel.qqmathline(y, distribution=function(p) qt(p,df=19),col=2) panel.qqmath(x, y , distribution=function(p) qt(p,df=19),pch=.,cex=2) } ) Adding f.value=fn as argument to qqmath reduces the size of the image, but neither the axis (absicissae) nor the line added by panel.qqmathline are right. Adding f.value=fn as argument to panel.qqmathline and panel.qqmath generates the right graphic, but the size of the image is again 20 MB. Any Suggestions? Eryk [EMAIL PROTECTED] wrote: nwew [EMAIL PROTECTED] wrote: Dear R helpers, I generate a qq plot using the following function call. ... dim(xx) [1] 680237 2 How about doing something like this: fn - function(n,cut=0.001,m=1000) { p - ppoints(n) p - p[pmin(p, 1-p) cut] q - pt(seq(qt(cut,df=19),qt(1-cut,df=19),length=m),df=19) sort(c(p,q)) } then adding 'f.value=fn' to your qqmath arguments? This essentially says, plot the individual data points in the extreme tails of the distribution (p 0.001 or p 0.999), and evaluate the distribution at a sparse set of points in between, where the density means you can't discern the individual values anyway. -- Dave __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] regression methods for circular(?) data.
Hi, I do not know the intercept and slope. And you have to know them in order to do something like: ix-(y 0.9*(x-50)/200 I am right? cheers (Ted Harding) wrote: On 26-Sep-05 nwew wrote: Dear R-users, I have the following data x - runif(300,min=1,max=230) y - x*0.005 + 0.2 y - y+rnorm(100,mean=0,sd=0.1) y - y%%1 # --- modulo operation plot(x,y) and would like to recapture the slope (0.005) and intercept(0.2). I wonder if there are any clever algorithms to do this. I was looking at the function lm.cirucalar. Is this the method to use? If, which of the references is best too look at? Eryk Hi Eryk, If you know the modulus (in your case 1.0) and you get data that look like the result of your plot(x,y), then I wouldn't mess about. I would simply do something like y1-y ix - ix-(y 0.9*(x-50)/200) y1[ix] - y1[ix]+1.0 lm(y1~x) (the constants 0.9/200, -50 being chosen to give a good separation on the graph). On the other hand, if there are good reasons why this very simple approach is not suitable, then if we knew what they were a more helpful reply would be easier to formulate! Best wishes, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 26-Sep-05 Time: 15:56:48 -- XFMail -- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] regression methods for circular(?) data.
Ted, I agree with you that if you unwrap the data you can use lm. And you can separate the data in the way you describe. However, if you have thousands of such datasets I do not want to do it by looking at the graph. Yes the scatter may be larger as in the example and range(y) may be larger than 2. And as you said in order to unwrap the data you have to separate them first. It would be easy to do it using for example single linkage clustering if they were no overlaps (but they do sometimes). So I were just wondering if there are no more fancy methods to do this. Thanks, cheers (Ted Harding) wrote: On 26-Sep-05 Witold Eryk Wolski wrote: Hi, I do not know the intercept and slope. And you have to know them in order to do something like: ix-(y 0.9*(x-50)/200 I am right? cheers Although I really knew them from the way you generated the data, I pretended I did not know them. Read below: If you know the modulus (in your case 1.0) -- I did assume that this was known, i.e. that the data wrap round to 0 above 1.0. Also: the constants 0.9/200, -50 being chosen to give a good separation on the graph -- I plotted the data, and saw that the wrapped data were well separated, and that 0.9*(x-50)/200 was an adequate discriminant function. This was estimated purely by eye, by looking at the graph, to find some line that went between the two groups of data; no attempt was made to calculate anything precisely. Apart from assuming that the modulus was 1.0, and that the well-separated data at the bottom right of the graph were wrapped round data, no other information was used by me! So the question remains: If you can assume that the modulus is 1.0, and that the wrapped-round data will be well separated, then all is simple. All you need to do is to unwrap the wrapped data by adding 1.0, having first identified them by virtue of their obvious separation. Then you can estimate the slope by using 'lm'. But:-- if you, Witold, can not assume these two things for your real data, what can we assume in considering your question? Is the modulus unknown, for instance? Is the scatter so large that the groups are not well separated? Might we have twice-wrapped data (i.e. original y 2)? In short, do your real data look like the data you sent us, and are they wrapped at 1.0? or what? With thanks, and best wishes, Ted. (Ted Harding) wrote: On 26-Sep-05 nwew wrote: Dear R-users, I have the following data x - runif(300,min=1,max=230) y - x*0.005 + 0.2 y - y+rnorm(100,mean=0,sd=0.1) y - y%%1 # --- modulo operation plot(x,y) and would like to recapture the slope (0.005) and intercept(0.2). I wonder if there are any clever algorithms to do this. I was looking at the function lm.cirucalar. Is this the method to use? If, which of the references is best too look at? Eryk Hi Eryk, If you know the modulus (in your case 1.0) and you get data that look like the result of your plot(x,y), then I wouldn't mess about. I would simply do something like y1-y ix - ix-(y 0.9*(x-50)/200) y1[ix] - y1[ix]+1.0 lm(y1~x) (the constants 0.9/200, -50 being chosen to give a good separation on the graph). On the other hand, if there are good reasons why this very simple approach is not suitable, then if we knew what they were a more helpful reply would be easier to formulate! Best wishes, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 26-Sep-05 Time: 15:56:48 -- XFMail -- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 26-Sep-05 Time: 18:08:28 -- XFMail -- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Interaction term in anova - how it should be written in a manuscript table?
Thanks a lot cheers Eryk Marc Schwartz wrote: For a me too post, I agree with Andy's recommendation, which in turn is supported by How to Report Statistics in Medicine by Lang and Secic, ACP, 1997. There is an example table (8.2) on page 133. HTH, Marc Schwartz On Sun, 2005-03-20 at 15:44 -0500, Liaw, Andy wrote: I'd suggest a $\times$ b, as you'd find in most stat textbook. Andy From: Witold Eryk Wolski Dear Rgurus, Interaction terms in the linear models function lm are specified by the colon : eg: x ~ a + b + a:b a shortcut for the above is: x ~ a*b the output if calling anova on the lm object will be the same in both cases a b a:b ... Resdiuals ... What I am wondering is how the interaction term (a:b) given above should be written in a table in an manuscript? a ) a*b b ) a$\cdot$ b c ) a:b d) Cheers Eryk. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Witold Eryk Wolski __( School of Mathematics and Statistics _ \__/ University of Newcastle 'v' ||Newcastle upon Tyne, NE1 7RU, ENGLAND / \ ^^mail: [EMAIL PROTECTED] m m Phone : 044 (0)191 222 5376 FAX : 044 (0)191 222 8020 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Violin plot for discrete variables.
Dear Rgurus, To my knowledge the best way to visualize the distribution of a discrete variable X is plot(table(X)) The problem which I have is the following. I have to discrete variables X and Y which distribution I would like to compare. To overlay the distribution of Y with lines(table(Y)) gives not satisfying results. This is the same in case of using density or histogram. Hence, I am wondering if there is a equivalent of the vioplot function (package vioplot) for discrete variables which starts with a boxplot and than adds a rotated plot(table()) plot to each side of the box plot. Maybee I should ask it first: Does such a plot make any sense? If not are there better solutions? cheers Eryk. -- Witold Eryk Wolski __( School of Mathematics and Statistics _ \__/ University of Newcastle 'v' ||Newcastle upon Tyne, NE1 7RU, ENGLAND / \ ^^mail: [EMAIL PROTECTED] m m Phone : 044 (0)191 222 5376 FAX : 044 (0)191 222 8020 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Interaction term in anova - how it should be written in a manuscript table?
Dear Rgurus, Interaction terms in the linear models function lm are specified by the colon : eg: x ~ a + b + a:b a shortcut for the above is: x ~ a*b the output if calling anova on the lm object will be the same in both cases a b a:b ... Resdiuals ... What I am wondering is how the interaction term (a:b) given above should be written in a table in an manuscript? a ) a*b b ) a$\cdot$ b c ) a:b d) Cheers Eryk. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Concatenate vector into string
Matthieu Cornec wrote: Hello, I would like to convert c(a,b,c) into abc. Anyone could help? Thanks, Matthieu Cornec __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html paste( c(a,b,c),collapse=) Eryk -- Witold Eryk Wolski __( School of Mathematics and Statistics _ \__/ University of Newcastle 'v' ||Newcastle upon Tyne, NE1 7RU, ENGLAND / \ ^^mail: [EMAIL PROTECTED] m m Phone : 044 (0)191 222 5376 FAX : 044 (0)191 222 8020 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Hot to _set_ an xmlAttr XML xmlAttr set
Dear R-Gurus! I have read an xml document with xmlTreeParse and can access that attribute value by xmlGetAttr or xmlAttrs What I want to do is to set a new value and to write the modified DOM tree into an XML file. But until now I have not found an setter method equivalent to the getter method? Eryk -- Witold Eryk Wolski __( School of Mathematics and Statistics _ \__/ University of Newcastle 'v' ||Newcastle upon Tyne, NE1 7RU, ENGLAND / \ ^^mail: [EMAIL PROTECTED] m m Phone : 044 (0)191 222 5376 FAX : 044 (0)191 222 8020 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Need suggestions for plotting 3D plot
Hi, http://www.stat.ucl.ac.be/ISpersonnel/lecoutre/stats/fichiers/_gallery.pdf The document above starts showing 3 different types of 3D graphics persp scatterplot3d wireframe A few days ago there was a discussion here on the list about providing a graph library. During this discussion several resources of example code where mentioned ( inter-alia that above). So if you need more ideas follow search this e-mails. cheers Eryk Soumyadeep nandi wrote: Hi Everybody, I am a newbie in R. I have a data in the form of a matrix which I want to make some 3D plots using R. There is some functions for instance hist() for 2D plots, but I cant find any function for 3D plots. Is there any function available in R for 3D plots? If so, is there any documention available on internet so that I can go through. With regards, Soumyadeep __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Witold Eryk Wolski __( School of Mathematics and Statistics _ \__/ University of Newcastle 'v' ||Newcastle upon Tyne, NE1 7RU, ENGLAND / \ ^^mail: [EMAIL PROTECTED] m m Phone : 044 (0)191 222 5376 FAX : 044 (0)191 222 8020 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Renaming columns in data.frame, inserting/removing columns from data.frame
Ken Termiso wrote: Hello, I'm hoping that there is an easier way to rename columns in a data frame other than by using the names() assignment, which requires you to type in all the column names at once for a data.frame, in the case that I simply want to rename a single column in a data frame. names(mydataframe)[column.index]-new.name Also, is there an easy way to move columns in a data frame around relative to the other columns? ?subset or mydataframe[c(column3,column2,column1)] Thanks in advance, Ken __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Dipl. bio-chem. Witold Eryk Wolski MPI-Moleculare Genetic Ihnestrasse 63-73 14195 Berlin tel: 0049-30-83875219 __(_ http://www.molgen.mpg.de/~wolski \__/'v' http://r4proteomics.sourceforge.net||/ \ mail: [EMAIL PROTECTED]^^ m m [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Need your help with my R plot
Latha Raja wrote: Hi, I am using R to plot the graph and the problem I am facing with my graph is that I have lots of points concentrated in one area and It is creating a visualization challenge. Is there any commands in R I could use to solve this problem. Even if there is no command, do you know how I could tackle this problem...(I want to separate these points so I could see each of them...) Any help is much appreciated... Thank you kindly Latha __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Hi, Take a look at the function: ixyplot in the package IDPmisc. Eryk -- Dipl. bio-chem. Witold Eryk Wolski MPI-Moleculare Genetic Ihnestrasse 63-73 14195 Berlin tel: 0049-30-83875219 __(_ http://www.molgen.mpg.de/~wolski \__/'v' http://r4proteomics.sourceforge.net||/ \ mail: [EMAIL PROTECTED]^^ m m [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] S4 class no longer accepts matrix in array slot under 2.0.1
Giles Heywood wrote: I have an S4 class with a slot of class array, and in upgrading to 2.0.1 (from 1.9.1) I have encountered a change in behaviour. This causes me some difficulties if I want to allow 2-dimensional arrays in the slot. The following (in 2.0.1) illustrates the point: setClass(foo,representation(array)) [1] foo a - new(foo,array(NA,2:4)) b - new(foo,matrix(NA,2,3)) Error in as-(`*tmp*`, Classi, value = c(NA, NA, NA, NA, NA, NA)) : No method or default for as() replacement of foo with Class=matrix This last error did not occur under 1.9.1. I conclude that in this context the methods package does not recognise matrix as a subclass of array. However if I use getClass(), I see that R recognises matrix as a subclass of array (and vice-versa). So is this new behaviour correct? [this is a simplified (and final) reposting of an earlier question entitled matrix no longer is array in 2.0.1?] Hi, setClass(foo,representation(matrix)) [1] foo a - new(foo,array(NA,2:4)) b - new(foo,matrix(NA,2,3)) Will work. As you say array has a subclass matrix. getClass(array) Known Subclasses: matrix and getClass(matrix) Known Subclasses: Class array, directly, with explicit test and coerce and matrix has a subclass array. What probably is necessary to use polymorphism - assigning a subclass to the parent class is the explicit test and coearce. It seems that matrix is the superclass of array. /E __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Dipl. bio-chem. Witold Eryk Wolski MPI-Moleculare Genetic Ihnestrasse 63-73 14195 Berlin tel: 0049-30-83875219 __(_ http://www.molgen.mpg.de/~wolski \__/'v' http://r4proteomics.sourceforge.net||/ \ mail: [EMAIL PROTECTED]^^ m m [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] scatterplot of 100000 points and pdf file format
Prof Brian Ripley wrote: On Wed, 24 Nov 2004 [EMAIL PROTECTED] wrote: On 24-Nov-04 Witold Eryk Wolski wrote: Hi, I want to draw a scatter plot with 1M and more points and save it as pdf. This makes the pdf file large. So i tried to save the file first as png and than convert it to pdf. This looks OK if printed but if viewed e.g. with acrobat as document figure the quality is bad. Anyone knows a way to reduce the size but keep the quality? If you want the PDF file to preserve the info about all the 1M points then the problem has no solution. The png file will already have suppressed most of this (which is one reason for poor quality). I think you should give thought to reducing what you need to plot. Think about it: suppose you plot with a resolution of 1/200 points per inch (about the limit at which the eye begins to see rough edges). Then you have 4 points per square inch. If your 1M points are separate but as closely packed as possible, this requires 25 square inches, or a 5x5 inch (= 12.7x12.7 cm) square. And this would be solid black! Presumably in your plot there is a very large number of points which are effectively indistinguisable from other points, so these could be eliminated without spoiling the plot. I don't have an obviously best strategy for reducing what you actually plot, but perhaps one line to think along might be the following: 1. Multiply the data by some factor and then round the results to an integer (to avoid problems in step 2). Factor chosen so that the result of (4) below is satisfactory. 2. Eliminate duplicates in the result of (1). 3. Divide by the factor you used in (1). 4. Plot the result; save plot to PDF. As to how to do it in R: the critical step is (2), which with so many points could be very heavy unless done by a well-chosen procedure. I'm not expert enough to advise about that, but no doubt others are. unique will eat that for breakfast x - runif(1e6) system.time(xx - unique(round(x, 4))) [1] 0.55 0.09 0.64 0.00 0.00 length(xx) [1] 10001 ?table - reduces the data and ?image - shows it. And this is doing exactly what I need. (not my idea but one of Thomas Unternäher). Thanks Thomas. /E -- Dipl. bio-chem. Witold Eryk Wolski MPI-Moleculare Genetic Ihnestrasse 63-73 14195 Berlin tel: 0049-30-83875219 __(_ http://www.molgen.mpg.de/~wolski \__/'v' http://r4proteomics.sourceforge.net||/ \ mail: [EMAIL PROTECTED]^^ m m [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] scatterplot of 100000 points and pdf file format
Hi, I want to draw a scatter plot with 1M and more points and save it as pdf. This makes the pdf file large. So i tried to save the file first as png and than convert it to pdf. This looks OK if printed but if viewed e.g. with acrobat as document figure the quality is bad. Anyone knows a way to reduce the size but keep the quality? /E -- Dipl. bio-chem. Witold Eryk Wolski MPI-Moleculare Genetic Ihnestrasse 63-73 14195 Berlin tel: 0049-30-83875219 __(_ http://www.molgen.mpg.de/~wolski \__/'v' http://r4proteomics.sourceforge.net||/ \ mail: [EMAIL PROTECTED]^^ m m [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] scatterplot of 100000 points and pdf file format
Hi, I tried the ps idea. But I am using pdflatex. You get a even larger size reduction if you convert the ps into a pdf using ps2pdf. But unfortunately there is a quality loss. I have found almost a working solution: a) Save the scatterplot without axes and with par(mar=c(0,0,0,0)) as png . b) convert it using any program to pnm c) read the pnm file using pixmap d) Add axes labels and lines afterwards with par(new=TRUE) And this looks like I would like that it looks like. But unfortunately acroread and gv on window is crashing when I try to print the file. png(file=pepslop.png,width=500,height=500) par(mar=c(0,0,0,0)) X2-rnorm(10) Y2-X2*10+rnorm(10) plot(X2,Y2,pch=.,xlab=,ylab=,main=,axes=F) dev.off() pdf(file=pepslop.pdf,width=7,height=7) par(mar=c(3.2,3.2,1,1)) x - read.pnm(pepslop.pnm ) plot(x) par(new=TRUE) par(mar=c(3.2,3.2,1,1)) plot(X2,Y2,pch=.,xlab=,ylab=,main=,type=n) mtext(expression(m[nominal]),side=1,line=2) mtext(expression(mod(m[monoisotopic],1)),side=2,line=2) legend(1000,4,expression(paste(lambda[DB],=,0.000495)),col=2,lty=1,lwd=1) abline(test,col=2,lwd=2) dev.off() Marc Schwartz wrote: On Wed, 2004-11-24 at 16:34 +0100, Witold Eryk Wolski wrote: Hi, I want to draw a scatter plot with 1M and more points and save it as pdf. This makes the pdf file large. So i tried to save the file first as png and than convert it to pdf. This looks OK if printed but if viewed e.g. with acrobat as document figure the quality is bad. Anyone knows a way to reduce the size but keep the quality? Hi Eryk! Part of the problem is that in a pdf file, the vector based instructions will need to be defined for each of your 10 ^ 6 points in order to draw them. When trying to create a simple example: pdf() plot(rnorm(100), rnorm(100)) dev.off() The pdf file is 55 Mb in size. One immediate thought was to try a ps file and using the above plot, the ps file was only 23 Mb in size. So note that ps can be more efficient. Going to a bitmap might result in a much smaller file, but as you note, the quality does degrade as compared to a vector based image. I tried the above to a png, then converted to a pdf (using 'convert') and as expected, the image both viewed and printed was pixelated, since the pdf instructions are presumably drawing pixels and not vector based objects. Depending upon what you plan to do with the image, you may have to choose among several options, resulting in tradeoffs between image quality and file size. If you can create the bitmap file explicitly in the size that you require for printing or incorporating in a document, that is one way to go and will preserve, to an extent, the overall fixed size image quality, while keeping file size small. Another option to consider for the pdf approach, if it does not compromise the integrity of your plot, is to remove any duplicate data points if any exist. Thus, you will not need what are in effect redundant instructions in the pdf file. This may not be possible depending upon the nature of your data (ie. doubles) without considering some tolerance level for equivalence. Perhaps others will have additional ideas. HTH, Marc Schwartz __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Dipl. bio-chem. Witold Eryk Wolski MPI-Moleculare Genetic Ihnestrasse 63-73 14195 Berlin tel: 0049-30-83875219 __(_ http://www.molgen.mpg.de/~wolski \__/'v' http://r4proteomics.sourceforge.net||/ \ mail: [EMAIL PROTECTED]^^ m m [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] scatterplot of 100000 points and pdf file format
Hi, Yes, indeed the hexbin package generates very cool pix. They look great. I was using it already. But this time I am interested in visualizing exactly the _scatter_ of some extreme points. Eryk Liaw, Andy wrote: Marc/Eryk, I have no experience with it, but I believe the hexbin package in BioC was there for this purpose: avoid heavy over-plotting lots of points. You might want to look into that, if you have not done so yet. Best, Andy From: Marc Schwartz On Wed, 2004-11-24 at 16:34 +0100, Witold Eryk Wolski wrote: Hi, I want to draw a scatter plot with 1M and more points and save it as pdf. This makes the pdf file large. So i tried to save the file first as png and than convert it to pdf. This looks OK if printed but if viewed e.g. with acrobat as document figure the quality is bad. Anyone knows a way to reduce the size but keep the quality? Hi Eryk! Part of the problem is that in a pdf file, the vector based instructions will need to be defined for each of your 10 ^ 6 points in order to draw them. When trying to create a simple example: pdf() plot(rnorm(100), rnorm(100)) dev.off() The pdf file is 55 Mb in size. One immediate thought was to try a ps file and using the above plot, the ps file was only 23 Mb in size. So note that ps can be more efficient. Going to a bitmap might result in a much smaller file, but as you note, the quality does degrade as compared to a vector based image. I tried the above to a png, then converted to a pdf (using 'convert') and as expected, the image both viewed and printed was pixelated, since the pdf instructions are presumably drawing pixels and not vector based objects. Depending upon what you plan to do with the image, you may have to choose among several options, resulting in tradeoffs between image quality and file size. If you can create the bitmap file explicitly in the size that you require for printing or incorporating in a document, that is one way to go and will preserve, to an extent, the overall fixed size image quality, while keeping file size small. Another option to consider for the pdf approach, if it does not compromise the integrity of your plot, is to remove any duplicate data points if any exist. Thus, you will not need what are in effect redundant instructions in the pdf file. This may not be possible depending upon the nature of your data (ie. doubles) without considering some tolerance level for equivalence. Perhaps others will have additional ideas. HTH, Marc Schwartz __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp Dohme or MSD and in Japan, as Banyu) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system. -- -- Dipl. bio-chem. Witold Eryk Wolski MPI-Moleculare Genetic Ihnestrasse 63-73 14195 Berlin tel: 0049-30-83875219 __(_ http://www.molgen.mpg.de/~wolski \__/'v' http://r4proteomics.sourceforge.net||/ \ mail: [EMAIL PROTECTED]^^ m m [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] R/S-related projects on Sourceforge? Trove Categorization
Hi, This are the project which I have extracted from all your mails. 1. http://sourceforge.net/projects/rpgsql/ R PostgreSQL Interface 2. http://sourceforge.net/projects/r-spatial/ R package for spatial data classes 3. http://sourceforge.net/projects/rpy/ RPy (R from Python) 4. http://sourceforge.net/projects/ep-sf/ Expression Profiler 5. http://sourceforge.net/projects/fsap fish stock assessment for R 6. http://sourceforge.net/projects/flr/ R packages for use in fisheries modelling 7. https://sourceforge.net/projects/runit/ R Unit Test Framework 8. http://sourceforge.net/projects/ep-sf/ Expression Profiler 9. http://sourceforge.net/projects/r-asp/ Analysis of Spatial Data in R 10. http://sourceforge.net/projects/r4proteomics/ R Packages for proteomics 11. http://sourceforge.net/projects/rdbi/ R Database Interface 12. http://sourceforge.net/projects/nlmeode/ R package combining nlme and odesolve 13. http://sourceforge.net/projects/rarcinfo/ RArcInfo 14. http://sourceforge.net/projects/rgdal GDAL Package for R 15. http://sourceforge.net/projects/gretl/ GNU Regression, Econometrics and Time-series Library 16. ... Sorry if I have missed any. But it is surely more than five. Thanks all of you for your numerous response and also for some more general thoughts concerning *collaboratory* development using source code repositories: https://stat.ethz.ch/pipermail/r-devel/2004-November/031398.html. If I see how R is evolving I believe that this ideas will be realized soon. Especially that there are already repositories covering some of the functionality and dedicated to R -- Bioconductor with a svn archive. Unfortunately, as I was told by Geff Gentry the costs of administering the svn, cvs servers are high, hence the number of developers must be limited. Also CRAN has some of the functionality but the svn or cvs support is missing. Luckily hosting the sources on e.g. sourceforge and the builds on CRAN or Bioconductor gives already some of the essential functionality. Therefore at this place big thanks to the Bioconductor, CRAN and sourceforge people. /E __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] R/S-related projects on Sourceforge? Trove Categorization
Hi R-Users and Developers, Several months ago I made a request on Sourceforge to add the R/S - programming language to the _Trove_ categorization. (The Trove is a means to convey basic metainformation about your project.) Today I got the following response of one of the sourceforge admins. SNIP SourceForge.net will consider the inclusion of a programming language within the Trove system when we host at least 5 projects based on that language. Please advise: Do you know of 5 projects hosted on SourceForge.net based on this language? SNIP If anyone of you knew about R-packages, or projects using the R/S programming language, which are hosted on sourceforge, please reply to this thread. I hope that your answers will enable me to give more then 5 examples of R projects hosted on Sourceforge. Yours Eryk Ps. The ID of my original feature request on Sourceforge is 967697. https://sourceforge.net/tracker/?func=detailatid=350001aid=967697group_id=1 -- Dipl. bio-chem. Witold Eryk Wolski MPI-Moleculare Genetic Ihnestrasse 63-73 14195 Berlin tel: 0049-30-83875219 __(_ http://www.molgen.mpg.de/~wolski \__/'v' http://r4proteomics.sourceforge.net||/ \ mail: [EMAIL PROTECTED]^^ m m [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] - assignment no long work in class methods
Gang Liang wrote: Hi- I used to use - to do assignment inside a class method, and just found that now it is broken in R 2.0. For example, the following code --- setClass( myclass, representation(x=numeric) ) setGeneric(incrXByOne, function(obj) standardGeneric(incrXByOne)) setMethod( incrXByOne, myclass, function(obj) [EMAIL PROTECTED] - [EMAIL PROTECTED] + 1 ) Hi, What (my guess) you want to define is: setMethod( incrXByOne, myclass, function(obj) [EMAIL PROTECTED] - [EMAIL PROTECTED] + 1;obj}) You do not need - to assign to a function argument? Its in my view even erroneous. This S code gives an error too. test - function(x) { x$bla-x$bla + 1 } test(1) Error in test(1) : Object x not found /E incrXByOne( new(myclass) ) --- will give an error message like: Error in incrXByOne(new(myclass)) : Object obj not found ## R failed to trace the object back to the GlobalEnv... It used to work under R1.7 - 1.9. I don't know whether this is a bug or a new feature... Anyone can recommend a workaround? Thanks, Gang - debian unstable, kernel 2.6.8 version platform i386-pc-linux-gnu arch i386 os linux-gnu system i386, linux-gnu status major2 minor0.0 year 2004 month10 day 04 language R __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Dipl. bio-chem. Witold Eryk Wolski MPI-Moleculare Genetic Ihnestrasse 63-73 14195 Berlin tel: 0049-30-83875219 __(_ http://www.molgen.mpg.de/~wolski \__/'v' http://r4proteomics.sourceforge.net||/ \ mail: [EMAIL PROTECTED]^^ m m [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] How to add values to an array at any position.
Hi, How to add values to an array at any position. Asking because of the following: e.g. y-c(0.1,NaN,0.2,NaN) #or data frame x-na.omit(y) take some columns from x and do some computation with functions which do not allow NaN 's. After the computing add NaN's at positions stored in attr(x,na.action) of the result vector. /E -- Dipl. bio-chem. Witold Eryk Wolski MPI-Moleculare Genetic Ihnestrasse 63-73 14195 Berlin tel: 0049-30-83875219 __(_ http://www.molgen.mpg.de/~wolski \__/'v' http://r4proteomics.sourceforge.net||/ \ mail: [EMAIL PROTECTED]^^ m m [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to add values to an array at any position.
Hi, In the first place I was wondering if there are no function _insert.vector_ in base. Thanks Peter and Gabor even for the bad news. E. Peter Dalgaard wrote: Witold Eryk Wolski [EMAIL PROTECTED] writes: Hi, How to add values to an array at any position. Asking because of the following: e.g. y-c(0.1,NaN,0.2,NaN) #or data frame x-na.omit(y) take some columns from x and do some computation with functions which do not allow NaN 's. After the computing add NaN's at positions stored in attr(x,na.action) of the result vector. You mean, something like ix - attr(x, na.action) newres - c(res,rep(NA,length(ix))) # just to get size and mode right newres[ix] - NA newres[-ix] - res -- Dipl. bio-chem. Witold Eryk Wolski MPI-Moleculare Genetic Ihnestrasse 63-73 14195 Berlin tel: 0049-30-83875219 __(_ http://www.molgen.mpg.de/~wolski \__/'v' http://r4proteomics.sourceforge.net||/ \ mail: [EMAIL PROTECTED]^^ m m [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] usage and behavior of 'setIs'
Hi Matthias, A similar problem to yours (with one level of inheritance less) was disccussed this month on the r-devel list. You find an answer from JChambers here: https://stat.ethz.ch/pipermail/r-devel/2004-October/030980.html And yes specifying _setAs_ to each _setIs_ with the coerce and replace is a _hack_ which is with this version of methods necessary when inherting from Old Classes. /E [EMAIL PROTECTED] wrote: Hello, am I using 'setIs' in the correct way in the subsequent (artifical) example? Do I have to specify explicit 'setAs' for 'list' and 'vector' or should this work automatically, since getClass(List1) states an explicit coerce also for these classes. I'm working with R 2.0.0 Patched (2004-10-06) on windows 2000. Thanks for your advice, Matthias # example setClass(Class = List1, representation(List = list)) setClass(Class = List2, contains = list) setIs(class1 = List1, class2 = List2, coerce = function(obj){ new(List2, [EMAIL PROTECTED]) }, replace = function(obj, value){ [EMAIL PROTECTED] - value }) getClass(List1) # states explicit coerce for 'list' and 'vector' getClass(List2) L1 - new(List1, List = list(a)) # all TRUE is(L1, List2) is(L1, list) is(L1, vector) as(L1, List2) # works # both return 'list()' # why not a 'list' with entry a? # Is there an additional 'setAs' needed? as(L1, list) as(L1, vector) L2 - as(L1, List2) as(L2, list) # works as(L2, vector) # works __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Dipl. bio-chem. Witold Eryk Wolski MPI-Moleculare Genetic Ihnestrasse 63-73 14195 Berlin tel: 0049-30-83875219 __(_ http://www.molgen.mpg.de/~wolski \__/'v' http://r4proteomics.sourceforge.net||/ \ mail: [EMAIL PROTECTED]^^ m m [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Intro to R: lecture presentation
Same behavior with Firefox 1.0Pr. /E Thomas Schönhoff wrote: Hello Arin, Arin Basu schrieb: A couple of weeks back, I asked a question on the list that I was invited to provide an introductory lecture on R to a group of academicians in Kolkata. I thank all of you who had generously guided me in providing me web links and words to the wise. Time to give back. I did the presentation on introduction to R and uploaded the presentation files at the following site: http://www.aloofhosting.com/arinbasu/Rtutorial/Rintroweb_files/frame.htm A shortened form of url is here (easy for cutting and pasting): http://tinyurl.com/3zsr6 Would greatly appreciate your feedbacks/opinions/advices on errors/omissions. Both links don't work for me, simply get an empty page and a black frame on both websites (IE optimzed?) running Mozilla-1.7.x on Debian GNU/Linux. sincerely Thomas __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Dipl. bio-chem. Witold Eryk Wolski MPI-Moleculare Genetic Ihnestrasse 63-73 14195 Berlin tel: 0049-30-83875219 __(_ http://www.molgen.mpg.de/~wolski \__/'v' http://r4proteomics.sourceforge.net||/ \ mail: [EMAIL PROTECTED]^^ m m [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] plot.dendrogram and plot.hclust ZOOM into the height?
Hi, I clustered a distance matrix and would like to draw it using plot.hclust or plot.dendrogram. The dendrogram is not informative because I have a few extremely small dissimilarities in the distance matrix (e.g. 0), but most of the other distances are in the range 1e10+-5000. I would like to show the tree only for the height of 1e10+-5000 but unfortunately their are no parameter like xlim,ylim in the function? Are there other ways to ZOOM? Any suggestions? /E -- Dipl. bio-chem. Witold Eryk Wolski MPI-Moleculare Genetic Ihnestrasse 63-73 14195 Berlin tel: 0049-30-83875219 __(_ http://www.molgen.mpg.de/~wolski \__/'v' http://r4proteomics.sourceforge.net||/ \ mail: [EMAIL PROTECTED]^^ m m [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Re: plot.dendrogram and plot.hclust ZOOM into the height?
Hi, Just noted that dendr2 - cut(dendr1,h=1) plot(dendr2$upper) Gives what I am looking for. Sorry, Its quite late here. /E Witold Eryk Wolski wrote: Hi, I clustered a distance matrix and would like to draw it using plot.hclust or plot.dendrogram. The dendrogram is not informative because I have a few extremely small dissimilarities in the distance matrix (e.g. 0), but most of the other distances are in the range 1e10+-5000. I would like to show the tree only for the height of 1e10+-5000 but unfortunately their are no parameter like xlim,ylim in the function? Are there other ways to ZOOM? Any suggestions? /E -- Dipl. bio-chem. Witold Eryk Wolski MPI-Moleculare Genetic Ihnestrasse 63-73 14195 Berlin tel: 0049-30-83875219 __(_ http://www.molgen.mpg.de/~wolski \__/'v' http://r4proteomics.sourceforge.net||/ \ mail: [EMAIL PROTECTED]^^ m m [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] C/C++
Hi, Unfortunately I have only some beginners hints to this very interesting topic. Writing R extensions provides examples how to execute r functions from within C code. There is also somewhere a doc how to use R as a shared library (?). But I dont remember in which doc exactly. Furthermore Rserv: rserv (http://www.rosuda.org/Rserve/index.shtml) has a C++ API for calling r functions. Eryk. doktora v wrote: Hey everyone, I have been looking for a while for ways to integrate R's wonderful functions into my C++ software, but I have not found anything concrete. So finally, i post to this list to see if anyouse else knows about this, or has done it!? Is it possible? Are there C++ or C R libraries? Or is it sufficiently easy to build them? your help is much appreciated! thanks doktora __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Dipl. bio-chem. Witold Eryk Wolski MPI-Moleculare Genetic Ihnestrasse 63-73 14195 Berlin tel: 0049-30-83875219 __(_ http://www.molgen.mpg.de/~wolski \__/'v' http://r4proteomics.sourceforge.net||/ \ mail: [EMAIL PROTECTED]^^ m m [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] colClasses
I would try. colClasses=c(character,numeric,character,numeric,numeric) /E Kalaylioglu, Zeynep (IMS) wrote: Hi I am trying to read a data frame from a text editor in to R. I want some of the columns to be read in as character not numeric. I figured that I can do that by using colClasses in read.table command. However, I couldn't find out how to use colClasses. e.g. say I have 5 column in the data file. I want 1st and 3rd column to be read in as character. How can I define this using colClasses? (or is there a better way to do what I want?) Thanks. Zeynep [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Dipl. bio-chem. Witold Eryk Wolski MPI-Moleculare Genetic Ihnestrasse 63-73 14195 Berlin _ tel: 0049-30-83875219 __( 'v' http://www.molgen.mpg.de/~wolski \__/ / \ mail: [EMAIL PROTECTED]^^ w w [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] R-(wiki)-pedia?
Thomas Petzoldt wrote: Tony Plate wrote: At Thursday 11:29 AM 10/7/2004, Dan Bolser wrote: [snip] I just added some pages... I think it would be great if people could get motivated to contribute to something like this. Its one of those cases of just getting the ball rolling... Do you think you can dump the existing R-docs into this wiki as a framework to get things going? If the existing R-docs are dumped into a wiki, won't the copy in the Wiki quickly get out of date? How does one get around this problem? And another problem is, how to reverse from something like HTML or XML back to .Rd ? I think that a generic format is absolutely necessary. The generic format we have and not yet another source of confusion. If wiki means editing .Rd sources or better: inverse transformation in both sides (without to many loss), it would be nice. Is there really a chance? Shurely their is. Define an XML schema. Write functions Rd2XML, XML2Rd, twiki2XML, . I am looking since ages for something like R2XML and XML2Rd. If we can agree on an XML format for the documentation it will be something to start with. Yours Thomas P. __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Dipl. bio-chem. Witold Eryk Wolski MPI-Moleculare Genetic Ihnestrasse 63-73 14195 Berlin _ tel: 0049-30-83875219 __( 'v' http://www.molgen.mpg.de/~wolski \__/ / \ mail: [EMAIL PROTECTED]^^ w w [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] setClass - equvalent declarations?
Hi, Why the third declation is not equivalent to the first 2 and gives a Warning #1 setClass(MVE,representation(list,names=character)) #2 setClass( MVE ,contains=list ,representation( names=character ) ) #3 setClass(MVE,matrix,representation(names=character)) [1] MVE Warning message: prototype is a list with named elements (could be ambiguous): better to use function prototype() to avoid trouble. in: reconcilePropertiesAndPrototype(name, slots, prototype, superClasses, /E. -- Dipl. bio-chem. Witold Eryk Wolski MPI-Moleculare Genetic Ihnestrasse 63-73 14195 Berlin _ tel: 0049-30-83875219 __( 'v' http://www.molgen.mpg.de/~wolski \__/ / \ mail: [EMAIL PROTECTED]^^ w w [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Reading multiple files into R
Hi! There is a function ?dir which returns you the content of the dir_ectory. If this is more then there is a function ?grep which allows you to extract relevant items. If you need to postprocess the names you have a function ?paste for example. And finally you have an S language construct for(){} And there is help.search() and An Introduction to R to which tells you how to write functions. /E Vikas Rawal wrote: I want to read data from a number of files into R. Reading individual files one by one requires writing enormous amount of code that will look something like the following. maptools:::dbf.read(wb-01vc.dbf)-dist1 maptools:::dbf.read(wb-02vc.dbf)-dist2 maptools:::dbf.read(wb-03vc.dbf)-dist3 maptools:::dbf.read(wb-04vc.dbf)-dist4 maptools:::dbf.read(wb-05vc.dbf)-dist5 maptools:::dbf.read(wb-06vc.dbf)-dist6 maptools:::dbf.read(wb-07vc.dbf)-dist7 maptools:::dbf.read(wb-08vc.dbf)-dist8 maptools:::dbf.read(wb-09vc.dbf)-dist9 * Is there a better way of doing this? Vikas __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Dipl. bio-chem. Witold Eryk Wolski MPI-Moleculare Genetic Ihnestrasse 63-73 14195 Berlin _ tel: 0049-30-83875219 'v' http://www.molgen.mpg.de/~wolski / \ mail: [EMAIL PROTECTED] ---W-W [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Rnewsletter article example
me too, E, Samuel Kemp wrote: Hi, I am trying to write an article for the Rnewsletter, but keep getting errors. I have googled around for some decent examples that contain figures, maths, etc but with no joy. Would any be so kind as to send me an example article in latex code? Cheers, Sam. __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Dipl. bio-chem. Witold Eryk Wolski MPI-Moleculare Genetic Ihnestrasse 63-73 14195 Berlin _ tel: 0049-30-83875219 'v' http://www.molgen.mpg.de/~wolski / \ mail: [EMAIL PROTECTED] ---W-W [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] function by
?by FUN: a function to be applied to data frame subsets of 'data'. ...: further arguments to 'FUN'. by (SS, year, sum) /E Emilie Berthiaume wrote: Hi, I'm just getting started with R and I'm having problems with some simple operations: I want to get the the sum of the column SStot for each year using the function by. The data set is named SS. I've tried this: by (SS, year, sum(SStot)) and it's not working. Is it because there's a different number of rows for each year? How else can I do this? -- Emilie Berthiaume Graduate student Biology Departement Université de Sherbrooke 2500 boul. de l'Université Sherbrooke, Québec J1K 2R1 CANADA Tél: 1-819-821-8000 poste 2059 Fax: 1-819-821-8049 [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Dipl. bio-chem. Witold Eryk Wolski MPI-Moleculare Genetic Ihnestrasse 63-73 14195 Berlin _ tel: 0049-30-83875219 'v' http://www.molgen.mpg.de/~wolski / \ mail: [EMAIL PROTECTED] ---W-W [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Is there any way to release memory in running time?
?gc /E [EMAIL PROTECTED] wrote: Hi all, I am doing some intensive computation right now. My system is Pentium4 3.20G + 1.0G RAM + WindowsXP + R1.9.1. It seems my computer is very powerful. However, when I do some simple matrix algebra operations based on a matrix (DD) with dimension 500 by 2, I found that the consumption of RAM is huge. For example, the command a - 1 - DD[,2] eats my 100M RAM. Does anyone know how to release memory in the middle of program (running time)? BTW, the command rm() does not free memory unless you quit R as I as know. Thanks in advance. Rui __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Dipl. bio-chem. Witold Eryk Wolski MPI-Moleculare Genetic Ihnestrasse 63-73 14195 Berlin _ tel: 0049-30-83875219 'v' http://www.molgen.mpg.de/~wolski / \ mail: [EMAIL PROTECTED] ---W-W [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] add-on packages
Hi! install.packages(RMySQL) ^ ^ note the parenthesis /E Vikas Rawal wrote: I want to add RMySQL and RODBC packages to my R installation on redhat linux box. The command install.packages gives following output. What could be wrong? trying URL `http://cran.r-project.org/src/contrib/PACKAGES' Content type `text/plain; charset=iso-8859-1' length 202145 bytes opened URL .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ... downloaded 197Kb Error in unique(pkgs) : Object RMySQL not found ** Vikas __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Dipl. bio-chem. Witold Eryk Wolski MPI-Moleculare Genetic Ihnestrasse 63-73 14195 Berlin _ tel: 0049-30-83875219 'v' http://www.molgen.mpg.de/~wolski / \ mail: [EMAIL PROTECTED] ---W-W [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] slow loops in Monte Carlo Simulations
Hi! Have you taken a look at the MCMCpack - package on cran: This package contains functions for posterior simulation for a number of statistical models. All simulation is done in compiled C++ written in the Scythe Statistical Library Version 1.0. All models return coda mcmc objects that can then be summarized using the coda package. /E Nael Al Anaswah wrote: Hi there, I am running Monte Carlo Simulations in R using ordinary while (condition) loops. Since the number of iterations is something like 100.000 and within each iteration a given subsample is extended sequentially it takes hours to run the simulation. Does anyone know if there is either a way to avoid using loops in Monte Carlo Simulations or how to include possible faster c++ commands in R code? many thanks in advance. Nael Al-Anaswah - Nael Al-Anaswah Department of Econometrics University of Muenster Germany __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Dipl. bio-chem. Witold Eryk Wolski MPI-Moleculare Genetic Ihnestrasse 63-73 14195 Berlin _ tel: 0049-30-83875219 'v' http://www.molgen.mpg.de/~wolski / \ mail: [EMAIL PROTECTED] ---W-W [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] S4 method selection based on second argument
Hi, If it's the only reason why you think you have to use S4 then take a look at ?missing. If you are interested in S4: The first version gives an overview of setMethods. Then I give a simpler example. And finally a pure ?missing solution. A) Declare function repmat as generic if(!isGeneric(repmat)) setGeneric(repmat ,function(obx,oby,obz,...) standardGeneric(repmat)) #B = repmat(A, m, n) setMethod(repmat,signature(obx=numeric,oby=numeric,obz=numeric) ,function(obx,oby,obz){print(thre arg call) }) #B = repmat(A, [m n]) #B = repmat(A, n) setMethod(repmat,signature(obx=numeric,oby=numeric,obz=missing) ,function(obx,oby) { print(two arg) #handle the difference in oby. if(length(oby)==1) oby else obx }) ##END A ### #simpler #if(!isGeneric(repmat)) #commented out because you have already declared it. setGeneric(repmat ,function(object,...) standardGeneric(repmat)) setMethod(repmat,signature(object=numeric) ,function(object,oby,obz) { #using ?missing handle the differences. if(missing(obz)) print(new version) }) Note that you can have the same in S3 using ?missing something like this. repmat - function(A, m, n) { if(missing(n) { if(length(m)==2) { repmat1(A, m[1], m[2]) } else kronecker(matrix(1, m, m), A) } kronecker(matrix(1, n, m), A)} } /E Paul Roebuck wrote: I'm translating some Matlab code and need some help figuring out how to change this call into an S4 generic method. In matlab, there's a function called 'repmat' with three calling sequences (all I have to deal with anyway): 1) B = repmat(A, m, n) 2) B = repmat(A, [m n]) 3) B = repmat(A, n) In all cases, A is the fill value, m is number of rows, and n is number of columns. As separate functions, the translations would roughly be: repmat1 - function(A, m, n) { kronecker(matrix(1, n, m), A) } repmat2 - function(A, rc) { repmat1(A, rc[1], rc[2]) } repmat3 - function(A, n) { repmat1(A, n, n) } Suggestions? -- SIGSIG -- signature too long (core dumped) __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Dipl. bio-chem. Witold Eryk Wolski MPI-Moleculare Genetic Ihnestrasse 63-73 14195 Berlin _ tel: 0049-30-83875219 'v' http://www.molgen.mpg.de/~wolski / \ mail: [EMAIL PROTECTED] ---W-W [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html