RE: [R] Resampling Stats software
On Wed, 17 Dec 2003, Brandon Vaughn wrote: Thanks to everyone who wrote in with suggestions. I will check out the books mentioned. The book I mentioned Resampling: The New Statistics is actually available free online at: http://www.resample.com/content/text/index.shtml It seems pretty good as an introduction. But then again, I am new at this concept. An introduction to what? (It seems to confuse resampling and simulation-based inference.) Does anyone know right off hand how to do simple simulation with R? Like for instance, in the book mentioned above, there is an example of figuring out the probability that a company with 20 trucks with have 4 or more fail on a given day (the probability that any given truck fails is .10). So the way they do it is to simulate uniform numbers from 1 to 10, and let the number 1 represent a defective truck. So here is the setup in the program Resampling Stat: REPEAT 400 [repeat simulation 400 times] GENERATE 20 1,10 a [generate 20 numbers between 1 and 10; store in vector a] COUNT a = 1 b [count the number of 1's and store in vector b] SCORE b z [keep track of each trial in vector z] END [repeat process] COUNT z 3 k [count the number of times trials more than 3 and store] DIVIDE k 400 kk [convert to probability and store] PRINT kk[print result] This seems like a simple problem, and seemingly simple process in Resampling Stats. Any idea on how to get started doing this in R? However, the number of failures is a binomial variate, so it is much simpler in R, for example cnts - rbinom(400, 20, 0.1) mean(cnts = 4) However, doing 1 million runs was almost instantaneous on my machine. And the expected answer is pbinom(3, 20, 0.1, lower=FALSE) As a matter of terminology, this is not resampling as usually defined, so I do wonder exactly what it is you are after. For resampling in the usual sense, I would echo Jason's recommendation of Davison and Hinkley's CUP book. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Summaries
Hello UseRs: Excuses for my english. I have a dataset with 65000 records and I'd like to make a summary where I can view all the values (with the number of times that it repeats) that there are each column of my dataset. I tried with summary( ), str( ), but nothing gives me the result that I am loking for. Thank you very much. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Summaries
Have a look at 'table' To compute for all columns of your dataset, combine with 'apply': data(iris) apply(iris,2,table) [...] $Petal.Width 0.1 0.2 0.3 0.4 0.5 0.6 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 5 29 7 7 1 1 7 3 5 13 8 12 4 2 12 5 6 6 3 8 3 3 $Species setosa versicolor virginica 50 50 50 Eric At 09:18 18/12/2003, Perez Martin, Agustin wrote: Hello UseRs: Excuses for my english. I have a dataset with 65000 records and I'd like to make a summary where I can view all the values (with the number of times that it repeats) that there are each column of my dataset. I tried with summary( ), str( ), but nothing gives me the result that I am loking for. Thank you very much. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- L'erreur est certes humaine, mais un vrai désastre nécessite un ou deux ordinateurs. Citation anonyme -- Eric Lecoutre Informaticien/Statisticien Institut de Statistique / UCL TEL (+32)(0)10473050 [EMAIL PROTECTED] URL http://www.stat.ucl.ac.be/ISpersonnel/lecoutre __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] mailing list for basic questions - preliminary sum up
Tony == Tony Plate [EMAIL PROTECTED] on Wed, 17 Dec 2003 18:04:34 -0700 writes: Tony The suggestions of Tom (posting guide) and Andy (Eric Tony Raymond's How To Ask Questions The Smart Way) are Tony both good. Perhaps a good place to put an actual Tony posting guide and a link to Raymond's page would be at Tony the page pointed to by the link at the bottom of every Tony posting to R-help (ie Tony https://www.stat.math.ethz.ch/mailman/listinfo/r-help). Thank you for the suggestion; note however that this is a dynamically created page (by mailman) which is pretty tedious to edit much, or even have much text added. I can add one or two short paragraphs with more hyperlinks; however I think it would be better (and much better maintainable by all of R-core) to add more to the General Instructions section of the R-project page on the mailing list, http://www.R-project.org/mail.html#instructions which is pointed to (and you also mention below), or even split that page into more. Alternatively, even point to a page that you (someone in the R community) maintain. Tony I'm pretty sure that most people who are discouraged Tony from posting for fear of being scolded would be Tony willing to read at least that page. And currently Tony there are not many guidelines for posting on either Tony that page or on the General Instructions page it has Tony a link to. Tony Since these things happen only if some starts them, Tony I'll post the raw beginnings of a posting guide by the Tony end of the week (that is if there are no objections Tony and no-one else beats me to it). Yes, that would be real useful, and a service to the community, please use plain html -- thank you in advance! Tony On a related note, one of the few guidelines that is Tony under the General Instructions seems to be Tony potentially misleading to those who fail to understand Tony the distinction between R developers and package Tony maintainers (which is probably most beginners): It is recommended that you send mail to r-help (or r-devel if appropriate) rather than only to the R developers (who are also subscribed to the list, of course). This may save them precious time they can use for constantly improving R, and will typically also result in much quicker feedback for yourself. We'll gladly accept improvements to this: pIt is recommended that you send mail to r-help (or r-devel if appropriate) rather than only to the emR/em developers (who are also subscribed to the list, of course). This may save them precious time they can use for constantly improving emR/em, and will typically also result in much quicker feedback for yourself. /p Tony (I say this seems misleading because I've seen quite a Tony few times, in response to a post about a problem with Tony a package, people told that they should have contacted Tony the package maintainer first.) I'm not sure that this would be improved by a better text above. The main reason is that those posters are not aware of the difference of the R standard packages and arbitrary CRAN packages {the 'Recommended' ones taking a bit of a role in between: They do have unique maintainers, but problems potentially affect everyone, and R-core does take some moral responsibility for them} Further on the orginal subject: I think Frank Harrell's point (not a different list, but a new medium!) and subsequent suggestions do make much sense: If some of you can donate your time (and that *is* needed!) to build and actively maintain a forum / bulletin board / web-meeting place that could be a valuable asset for the R-project. We (R core) shouldn't have to use our resources for such a maintenance though. Martin Maechler [EMAIL PROTECTED] http://stat.ethz.ch/~maechler/ Seminar fuer Statistik, ETH-Zentrum LEO C16Leonhardstr. 27 ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND phone: x-41-1-632-3408 fax: ...-1228 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] barplot plot together
Dear colleges, I'm trying to combine a barplot and a plot in a single figure as follows: data - 1:6 t - barplot(data, axes=F) par(new= T) plot(t, data, type=b) However, as you can see in the example, the dots of the second plot do not fall in the midpoint of the bars in the first. Any trick for setting the 2 plots at the same scale? I have unsuccessfully tried: plot(t, data, type=b, xlim=c(0,7)) plot(t, data, type=b, xlim=c(min(t),max(t))) (R 1.8.1, for Windows) Thanks Juli -- Juli G. Pausas Centro de Estudios Ambientales del Mediterraneo (CEAM) C/ Charles R. Darwin 14, Parc Tecnologic, 46980 Paterna, Valencia, SPAIN Tel: (+ 34) 96 131 8227; Fax: (+ 34) 96 131 8190 mailto:[EMAIL PROTECTED] http://www.gva.es/ceam GCTE Fire Network - http://www.gva.es/ceam/FireNetwork __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] symbolic and algebraic computation
I needed a symbolic and algebraic computation software. The best solution I've found so far is maxima computer algebra system. I was wondering if there is any R package that has similar features as maxima's or somebody could point me to reference manuals on how to use R for this purpose. Thanks, Angel __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] barplot plot together
juli == juli g pausas [EMAIL PROTECTED] on Thu, 18 Dec 2003 10:54:08 +0100 writes: juli Dear colleges, juli I'm trying to combine a barplot and a plot in a single figure as follows: juli data - 1:6 juli t - barplot(data, axes=F) juli par(new= T) juli plot(t, data, type=b) juli However, as you can see in the example, the dots of juli the second plot do not fall in the midpoint of the juli bars in the first. Any trick for setting the 2 plots juli at the same scale? yes, use bd - barplot(data) points(bd, data, type = b) instead. A general recommendation: Try to *not* use par(new = TRUE) if you can. Martin __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] barplot plot together
juli g. pausas [EMAIL PROTECTED] writes: Dear colleges, I'm trying to combine a barplot and a plot in a single figure as follows: data - 1:6 t - barplot(data, axes=F) par(new= T) plot(t, data, type=b) However, as you can see in the example, the dots of the second plot do not fall in the midpoint of the bars in the first. Any trick for setting the 2 plots at the same scale? I have unsuccessfully tried: plot(t, data, type=b, xlim=c(0,7)) plot(t, data, type=b, xlim=c(min(t),max(t))) (R 1.8.1, for Windows) The canonical trick for getting two plots on the same scale is to set xlim (and ylim) on *both*. On barplots, this gets a bit tricky since you have to leave room for the column width (the actual calculation can be read inside barplot.default). However, I'd try for something like t - barplot(data,names=1:6,ylim=range(c(0,data*1.01))) points(t, data, type=b) -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Manova
Dear R-helpers, In a data set I got from a medical doctor there are six treatment groups and (about) 5 bivariate responses in each group. Using 'manova', it is easy to see significant differences in treatment effects, but the doctor is more interested in the correlation between the two responses (within groups). I'm willing to assume a common value over groups, and one way of estimating and testing the common correlation would be to use 'cor.test' on the residuals from 'manova', but I guess that the resulting p-value (from testing zero correlation) will be far too optimistic (it is in fact 4.5e-5). What is the 'right' way of doing this in R? -- Göran Broströmtel: +46 90 786 5223 Department of Statistics fax: +46 90 786 6614 Umeå University http://www.stat.umu.se/egna/gb/ SE-90187 Umeå, Sweden e-mail: [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Huynh-Feldt correction
Dear R-helpers, Does anybody know, whether there is an option to tell aov/anova, or do something similar, to get a Huynh-Feldt correction of dfs in the aov/anova function? Thanks in advance! __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] barplot plot together
Thank you very much! I'm using par(new = TRUE) because in my real case, the 2 plots have different ylim (different y-scale). I got what I wanted by using the same xlim in the barplot and in the plot, as suggested by Peter. My real case: par(mar= c(7, 4, 5, 5) + 0.1) area - c(136, 3426, 5594, 29268, 19080, 31461, 72629, 225443)/ 1 nfires - c(48, 134, 80, 131, 27, 24, 23, 14) t - barplot(area, xlim=c(0.5,9.5), ylim=c(0, 25), ylab=Area burnt (x 1000 ha), xlab=Fire size class) box() par(new= T, yaxs = i, xpd=TRUE) plot(t, nfires, type=o, xlim=c(0.5,9.5), pch=19, ylim=c(0, 140), axes=F, xlab=, ylab=) axis(4); mtext(Number of fires, side=4, line=3, col=1) legend(2, 155, Number, lty= 1, pch= 19, bty=n, cex=0.8) legend(2, 163, Area, fill= 2, bty=n, cex=0.8) Cheers Juli Martin Maechler wrote: juli == juli g pausas [EMAIL PROTECTED] on Thu, 18 Dec 2003 10:54:08 +0100 writes: juli Dear colleges, juli I'm trying to combine a barplot and a plot in a single figure as follows: juli data - 1:6 juli t - barplot(data, axes=F) juli par(new= T) juli plot(t, data, type=b) juli However, as you can see in the example, the dots of juli the second plot do not fall in the midpoint of the juli bars in the first. Any trick for setting the 2 plots juli at the same scale? yes, use bd - barplot(data) points(bd, data, type = b) instead. A general recommendation: Try to *not* use par(new = TRUE) if you can. Martin -- Juli G. Pausas Centro de Estudios Ambientales del Mediterraneo (CEAM) C/ Charles R. Darwin 14, Parc Tecnologic, 46980 Paterna, Valencia, SPAIN Tel: (+ 34) 96 131 8227; Fax: (+ 34) 96 131 8190 mailto:[EMAIL PROTECTED] http://www.gva.es/ceam GCTE Fire Network - http://www.gva.es/ceam/FireNetwork [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Manova
Göran Broström [EMAIL PROTECTED] writes: Dear R-helpers, In a data set I got from a medical doctor there are six treatment groups and (about) 5 bivariate responses in each group. Using 'manova', it is easy to see significant differences in treatment effects, but the doctor is more interested in the correlation between the two responses (within groups). I'm willing to assume a common value over groups, and one way of estimating and testing the common correlation would be to use 'cor.test' on the residuals from 'manova', but I guess that the resulting p-value (from testing zero correlation) will be far too optimistic (it is in fact 4.5e-5). I think you're getting correlation right, but the DF wrong since 5 DF are lost to treatment contrasts. Hence the t statistic is wrong too (wrong DF *and* inflated by about 20%). What is the 'right' way of doing this in R? Is there one? One expedient way is to look for a zero regression coef in summary(lm(v1~treat+v2)) # or vice versa or you could clone the calculation from getS3method(cor.test,default) r - cor(x, y) df - ??? # insert properly calculated DF here. STATISTIC - c(t = sqrt(df) * r/sqrt(1 - r^2)) p - pt(STATISTIC, df) or you could look for a test of independence in the multivariate normal distr. on CRAN. (I don't know if there is one -- it's your problem... ;-) ) -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
R: [R] `bivariate apply' - Summary
Dear all, Thanks to Thomas Lumley, Peter Wolf and Gabor Grothendieck for their reply The problem was to to apply a bivariate function (such as cor(), for instance) to each combination of colums of a given matrix. Below there are four possible solutions (the original message is also posted below). Using a matrix 5000x20, the best solutions seem to be f1 and f2. f1-function(mat, FUN, ...){ #author: Thomas Lumley nc-NCOL(mat) i-rep(1:nc, nc) j-rep(1:nc, each=nc) rval-mapply(function(ii,ji) FUN(mat[,ii], mat[,ji], ...), i, j) matrix(rval, nc=nc) } f2-function(x,fun=cor){ #author: Peter Wolf cl-matrix(1:ncol(x),ncol(x),ncol(x)) cl-cbind(as.vector(cl),as.vector(t(cl))) res-apply(cl,1,function(xx)fun(x[,xx[1]],x[,xx[2]])) matrix(res,ncol(x),ncol(x)) } f3 - function(x,f=cor) { #author: Gabor Grothendieck k - NCOL( x ) x - apply( x, 2, list ) ff - function(x,y) f( unlist(x), unlist(y) ) matrix( mapply( ff, rep(x,rep(k,k)), rep(x,k) ), k, k ) } f4-function(x,FUN,...){ #author: vito muggeo require(gregmisc) a-combinations(ncol(x),2) r-list() for(i in 1:nrow(a)){r[[length(r)+1]]- x[,a[i,]]} ris-matrix(1,ncol(x),ncol(x)) ris1-sapply(r, function(xx)FUN(xx[,1],xx[,2],...)) ris[col(ris)row(ris)]- ris[col(ris)row(ris)]-ris1 return(ris) } # test x - matrix( runif(5000*20), 5000, 20 ) system.time(f1( x, cor )) ##original message dear all, Given a matrix A, say, I would like to apply a bivariate function to each combination of its colums. That is if myfun-function(x,y)cor(x,y) #computes simple correlation of two vectors x and y then the results should be something similar to cor(A). I tried with mapply, outer,...but without success Can anybody help me? many thanks in advance, vito __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help ___ No banners. No pop-ups. No kidding. Introducing My Way - http://www.myway.com __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] RSPerl
If anyone can help it would be very much apreciated... System RedHat 9 R installed as # ./configure --enable-R-shlib # make # make install and R seems to work fine ... Then I do # R INSTALL --clean --configure-args='--with-in-perl' RSPerl_0.5-7.tar.gz # export R_HOME=/usr/local/lib/R # cd /usr/local/lib/R/library/RSPerl/examples/ # perl -I /usr/local/lib/R/library/RSPerl/share/blib/arch -I /usr/local/lib/R/library/RSPerl/share/blib/lib ./test.pl and I get 1..1 Can't load '/usr/local/lib/R/library/RSPerl/share/blib/arch/auto/R/R.so' for module R: /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/auto/ModPerl/Global/Global.so: undefined symbol: modperl_perl_global_avcv_call at /usr/lib/perl5/5.8.0/i386-linux-thread-multi/DynaLoader.pm line 229. at ./test.pl line 11 Compilation failed in require at ./test.pl line 11. BEGIN failed--compilation aborted at ./test.pl line 11. not ok 1 and I get completelly lost ... Thanks in advance for your help Andrea __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] RSPerl
Hi Andrea. When we run Perl from within R, any Perl module that has associated C code (such as modperl) needs a special piece of bootstrapping code to be used within this embedded case. Now in your case, you might only be calling R from within Perl, but neverthless, we put this bootstrapping code in as one can call Perl from within the embedded R because it is bidirectional. The modperl module is for running Perl embedded within the Apache Web server. So you don't need this for running R in Perl as a stand-alone. So we need to tell the RSPerl package not to include bootstrapping code for modperl (and other modules that cause problems in this way). To create this bootstrapping code for Perl modules with C code, the installation script for RSPerl looks through all the Perl modules and finds the ones that have C code (i.e. an associated shared library). In this case, you need to tell the RSPerl installation explicitly which modules to provide the boostrapping code. The easiest way for me to describe is the following. unzip and untar the RSPerl.tar.gz file cd RSPerl Run the command perl -s modules.pl -modules to get a list of all the modules with C code. Take this list and set the environment variable PERL_MODULES to the subset of these module names that you actually need/want. In your case, just remove modperl. You might do someting like setenv PERL_MODULES `perl -s modules.pl -modules | sed s/modperl//` (if you are using the csh or tcsh shell. Use export for bash/sh.) You can eliminate any of the modules that cause problems using this approach. Hope this helps. D. Andrea wrote: If anyone can help it would be very much apreciated... System RedHat 9 R installed as # ./configure --enable-R-shlib # make # make install and R seems to work fine ... Then I do # R INSTALL --clean --configure-args='--with-in-perl' RSPerl_0.5-7.tar.gz # export R_HOME=/usr/local/lib/R # cd /usr/local/lib/R/library/RSPerl/examples/ # perl -I /usr/local/lib/R/library/RSPerl/share/blib/arch -I /usr/local/lib/R/library/RSPerl/share/blib/lib ./test.pl and I get 1..1 Can't load '/usr/local/lib/R/library/RSPerl/share/blib/arch/auto/R/R.so' for module R: /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/auto/ModPerl/Global/Global.so: undefined symbol: modperl_perl_global_avcv_call at /usr/lib/perl5/5.8.0/i386-linux-thread-multi/DynaLoader.pm line 229. at ./test.pl line 11 Compilation failed in require at ./test.pl line 11. BEGIN failed--compilation aborted at ./test.pl line 11. not ok 1 and I get completelly lost ... Thanks in advance for your help Andrea __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- ___ Duncan Temple Lang[EMAIL PROTECTED] Bell Labs, Lucent Technologiesoffice: (908)582-3217 700 Mountain Avenue, Room 2C-259 fax:(908)582-3340 Murray Hill, NJ 07974-2070 http://cm.bell-labs.com/stat/duncan __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R]: Lp norm estimation
Hi all Just wondering whether one can undertake Lp norm estimation (a type of regression analysis) in R? i.e. argmin S ( | y(i) - x(i)b | ^p ) where: * S is the summation over observation i= 1,2,...,n * y is a vector of n observations * x is an n by p matrix of explanatory variables * b is a p by 1 vector of beta coefficients and * p is a constant to be estimated such that p= 1 Regards Allan [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] How to create Voronoi-Polygons ?
Dear List-Members, my name is Klemens Barfus and I am quite new to this list and to working with R. I try to generate Vornoi-Polygons with the Tripack package. I would like to have a table with the sites xy and the surrounding nodes of the Voronoi-Polygons. The area shall be delimited by a defined rectangle so that the polygons at the edge are cut by the rectangle sides. Is there a way to do this ? Looking the old list entries I found no help. First using voronoi.mosaic worked fine, but how to get the connection of the sites to the surrounding nodes. The other question is what the information of the voronoi.findrejectsites() functon is. For my testdata it showed 3 sites which ly at the edge, but it should be 6. ... Thanks for your help in advance ! Klemens -- __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] mailing list for basic questions - preliminary sum up
A 14:57 17/12/2003 +0100, Martin Wegmann a écrit: Hello, Roger Bivand wrote: appropriate light. One basic characteristic seems to be that if the question does indicate seriousness about trying to analyse data, respect for the task at hand, then predictably lots of good advice comes quickly. yes, I also experienced that (from the questioner point) I'm also not too sure about the learning R question. Of course there is the GUI/CLI issue, and the very many defaults already filled in issue, but actually market share really isn't a driver here, is it? Isn't this ok, I get this point - R can be seen more as philosphie than commercial thinking of getting market shares. i think it is a trade-off between spreading R and being a member of a geek statistic program (that's what SPSS user in this dept. think about us R user ;-) ) more about attitude and motivation in taking an active role in analysing data? If your research question really itches, what should it take to stop you learning R (or associated packages)? probably the steep learing curve but of course if you really want, you will suceed and explorere the advanteages of R. I think there is a deeper problem here: in many cases, scientists come to data analysis as a necessity to publish their results. They look for quick answers when analysing data. Thus learning a completely new system of data analysis may seem not only steep, but of limited interest. That sounds a bit like an elitist point of view - who really wants to use R will eventually suceed.but that's like everywhere in the opensource community - to get started with Linux or other software is still quite rough but a lot of people are doing it because of various reasons. This community has a great support mentality and are more worth than any commercial support and therefore it is possible. but I don't want to start a flame about this issue (elitist geek software ;-) )and therefore I would like to propose a evaluation - better in a separate mail to keep the overview. regards Martin __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help Emmanuel Paradis Laboratoire de Paléontologie Institut des Sciences de l'Évolution Université Montpellier II F-34095 Montpellier cédex 05 France phone: +33 4 67 14 39 64 fax: +33 4 67 14 36 10 mailto:[EMAIL PROTECTED] http://www.isem.univ-montp2.fr/PPP/PPPphylogenie/ParadisHome.php __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] How to create Voronoi-Polygons ?
Everything is possible, some things are just more difficult than others. It is a little tricky to find the point of intersection of the voronoi edges with the frame of the diagram. Your basic request is quite straightforward though. Here is a function that plots, by looping through the sites and using voronoi.findvertices() to get the vertices of the polygons. In the function fit represents a z coordinate that indicates the value of a fitted function at each of the sites, -- this may be irrelevant in your setup. I hope that it will help: plot.voronogram - function (x,y,fit) { tm - tri.mesh(x,y) xlim - c(min(tm$x) - 0.1 * diff(range(tm$x)), max(tm$x) + 0.1 * diff(range(tm$x))) ylim - c(min(tm$y) - 0.1 * diff(range(tm$y)), max(tm$y) + 0.1 * diff(range(tm$y))) plot.new() plot.window(xlim = xlim, ylim = ylim, ) n - length(x) vm - voronoi.mosaic(x,y) palette(topo.colors(100)) cfit - 100*fit for(i in 1:n){ vpolygon - voronoi.findvertices(i,vm) if(length(vpolygon)){ xx - vm$x[vpolygon] yy - vm$y[vpolygon] inhull - in.convex.hull(tm,xx,yy) polygon(xx[inhull],yy[inhull] ,col=cfit[i]) } } } url:www.econ.uiuc.edu/~roger/my.htmlRoger Koenker email [EMAIL PROTECTED] Department of Economics vox:217-333-4558University of Illinois fax:217-244-6678Champaign, IL 61820 On Thu, 18 Dec 2003, Klemens Barfus wrote: Dear List-Members, my name is Klemens Barfus and I am quite new to this list and to working with R. I try to generate Vornoi-Polygons with the Tripack package. I would like to have a table with the sites xy and the surrounding nodes of the Voronoi-Polygons. The area shall be delimited by a defined rectangle so that the polygons at the edge are cut by the rectangle sides. Is there a way to do this ? Looking the old list entries I found no help. First using voronoi.mosaic worked fine, but how to get the connection of the sites to the surrounding nodes. The other question is what the information of the voronoi.findrejectsites() functon is. For my testdata it showed 3 sites which ly at the edge, but it should be 6. ... Thanks for your help in advance ! Klemens -- __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] symbolic and algebraic computation
On Thu, 18 Dec 2003 11:19:20 +0100, Angel [EMAIL PROTECTED] wrote : I needed a symbolic and algebraic computation software. The best solution I've found so far is maxima computer algebra system. I was wondering if there is any R package that has similar features as maxima's or somebody could point me to reference manuals on how to use R for this purpose. R has limited capabilities to do this (for example, see ?deriv), but if you're doing anything serious, you're better off in a package designed for that purpose. Maple and Mathematica are both good (commercial) choices; I don't know how they compare to maxima, and I don't know the free ones. Duncan Murdoch __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] Resampling Stats software
From: Prof Brian Ripley [snip] As a matter of terminology, this is not resampling as usually defined, so I do wonder exactly what it is you are after. For resampling in the usual sense, I would echo Jason's recommendation of Davison and Hinkley's CUP book. Or perhaps at a gentler level, Efron Tibshirani's Introduction to the Bootstrap (Chapman Hall/CRC)... -- 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 Andy -- Notice: This e-mail message, together with any attachments,...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] Summaries
If your dataset contains integer or limited possible unique numbers only I find the following more concise. m - matrix( rpois(60, 5), nc=6 ) apply( m , 2, function(x) table( factor(x, levels=0:max(m))) ) If your dataset has continous or lots of unique numbers you may wish to consider only the summary statistics. You can try the function stats() or graphically bplot() [both from library fields] Regards, Adai. -Original Message- From: [EMAIL PROTECTED] on behalf of Eric Lecoutre Sent: Thu 18/12/2003 16:22 To: Perez Martin, Agustin; lista R help (E-mail) Cc: Subject: Re: [R] Summaries Have a look at 'table' To compute for all columns of your dataset, combine with 'apply': data(iris) apply(iris,2,table) [...] $Petal.Width 0.1 0.2 0.3 0.4 0.5 0.6 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 5 29 7 7 1 1 7 3 5 13 8 12 4 2 12 5 6 6 3 8 3 3 $Species setosa versicolor virginica 50 50 50 Eric At 09:18 18/12/2003, Perez Martin, Agustin wrote: Hello UseRs: Excuses for my english. I have a dataset with 65000 records and I'd like to make a summary where I can view all the values (with the number of times that it repeats) that there are each column of my dataset. I tried with summary( ), str( ), but nothing gives me the result that I am loking for. Thank you very much. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- L'erreur est certes humaine, mais un vrai dsastre ncessite un ou deux ordinateurs. Citation anonyme -- Eric Lecoutre Informaticien/Statisticien Institut de Statistique / UCL TEL (+32)(0)10473050 [EMAIL PROTECTED] URL http://www.stat.ucl.ac.be/ISpersonnel/lecoutre http://www.stat.ucl.ac.be/ISpersonnel/lecoutre __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] How to create Voronoi-Polygons ?
Roger Koenker wrote: Everything is possible, some things are just more difficult than others. Is that so? In which case, how can I construct a square with the same area as a given circle using only the compass() and ruler() functions? :) Baz PS redefining compass() and ruler() not allowed __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] bootstrap pValue in DClusters
Hello R-List I use DClusters package (I work in a cancer regestry). I have 2 questions about it: 1-how is it possible to get back the bootstrap pValue? I mean the pValue of the calculated statistic with respect of the distribution of this statistic under the null hypothesis. 2-how is it possible to test an overdispersion in the poisson model? for choosing a best model I need this mesure of dispersion. Should I build a glm(cases~expected,family=quasipoisson)$sig2 or is it possible directly in DClusters? Thank you, for advance for answers. Best regards, Erik A. Erik-André SAULEAU SEAIM Hôpital du Hasenrain BP 1070 87, Avenue de Altkirch 68051 MULHOUSE Cédex Tel: 03-89-64-79-95 Fax: 03-89-64-79-71 Mél: [EMAIL PROTECTED] Web: http://www.ch-mulhouse.fr Afin d'éviter toute propagation de virus informatique, et en complément des dispositifs en place, ce message (et ses pièces jointes s'il y en a) a été automatiquement analysé par un antivirus de messagerie. *** [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] NA, deleting rows
Dear colleges, I do not understand the following behaviour: aa - data.frame(a1= 1:10, a2= c(rep(NA, 5), 1:5) ) aa a1 a2 1 1 NA 2 2 NA 3 3 NA 4 4 NA 5 5 NA 6 6 1 7 7 2 8 8 3 9 9 4 10 10 5 aa[!aa$a2==1, ] # removing rows with a2==1 a1 a2 NA NA NA NA.1 NA NA NA.2 NA NA NA.3 NA NA NA.4 NA NA 7 7 2 8 8 3 9 9 4 10 10 5 I didn't expect a1 to be affected. Is aa[!aa$a2==1, ] an incorrect way to remove rows? Any other way? (R 1.8.1. for Windows) Thanks in advance Juli __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] How to create Voronoi-Polygons ?
One should doubt everything, even logic, and in doubt lies possibility. url:www.econ.uiuc.edu/~roger/my.htmlRoger Koenker email [EMAIL PROTECTED] Department of Economics vox:217-333-4558University of Illinois fax:217-244-6678Champaign, IL 61820 On Thu, 18 Dec 2003, Barry Rowlingson wrote: Roger Koenker wrote: Everything is possible, some things are just more difficult than others. Is that so? In which case, how can I construct a square with the same area as a given circle using only the compass() and ruler() functions? :) Baz PS redefining compass() and ruler() not allowed __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] ESS tab completion for file names
Hi all, Using Xemacs/ESS (Xemacs 21.4-12/ESS 5.1.24), I noticed that tab completion does not work for file names. df - read.csv(xx [TAB] doesn't complete the file name. After hitting TAB, I get last thing matched was not a buffer in the status bar. Any idea what may go wrong? Thanks for any advice Pascal __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Manova
On Thu, Dec 18, 2003 at 12:04:31PM +0100, Peter Dalgaard wrote: Göran Broström [EMAIL PROTECTED] writes: Dear R-helpers, In a data set I got from a medical doctor there are six treatment groups and (about) 5 bivariate responses in each group. Using 'manova', it is easy to see significant differences in treatment effects, but the doctor is more interested in the correlation between the two responses (within groups). I'm willing to assume a common value over groups, and one way of estimating and testing the common correlation would be to use 'cor.test' on the residuals from 'manova', but I guess that the resulting p-value (from testing zero correlation) will be far too optimistic (it is in fact 4.5e-5). I think you're getting correlation right, but the DF wrong since 5 DF are lost to treatment contrasts. Hence the t statistic is wrong too (wrong DF *and* inflated by about 20%). What is the 'right' way of doing this in R? Is there one? One expedient way is to look for a zero regression coef in summary(lm(v1~treat+v2)) # or vice versa or you could clone the calculation from getS3method(cor.test,default) r - cor(x, y) df - ??? # insert properly calculated DF here. STATISTIC - c(t = sqrt(df) * r/sqrt(1 - r^2)) p - pt(STATISTIC, df) Thanks Peter, that seems to be correct; zero correlation should be equivalent to zero regression. I wrote a function, 'grouped.cor', based on your second suggestion, and I get: grouped.cor(x, y, group) $p.value [1] 0.0002546125 ... compared to summary(lm(y ~ x + group)) ... x0.514950.11725 4.392 0.000255 *** quite close, right? Compare with the 'naive' value 0.45. Göran grouped.cor - function(x, y, group){ ## Assumes a common correlation over groups, and that ## x and y have constant variance, but ## their means may differ between groups. n - length(group) if ( (length(x) != n) || (length(y) != n)) stop(Length mismatch) n.grp - length(unique(group)) df - n - n.grp - 1 if (df 1) stop(Too many groups or too few observations) subtract.mean - function(x) x - mean(x) x - unlist(tapply(x, group, subtract.mean)) y - unlist(tapply(y, group, subtract.mean)) # NOTE: This will (eventually) reorder x and y, # but in the same way: doesn't affect cor(x, y)! res - cor.test(x, y) statistic - res$statistic * sqrt(df / (n - 2)) p - pt(statistic, df) p - 2 * min(p, 1 - p) list(p.value = p, statistic = statistic, df = df) } __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] NA, deleting rows
Take a look at what (aa$a2 == 1) returns and it may clear things up. Try aa[-which(aa$a2 == 1), ] or subset(aa, a2 != 1 | is.na(a2)) HTH, Sundar juli g. pausas wrote: Dear colleges, I do not understand the following behaviour: aa - data.frame(a1= 1:10, a2= c(rep(NA, 5), 1:5) ) aa a1 a2 1 1 NA 2 2 NA 3 3 NA 4 4 NA 5 5 NA 6 6 1 7 7 2 8 8 3 9 9 4 10 10 5 aa[!aa$a2==1, ] # removing rows with a2==1 a1 a2 NA NA NA NA.1 NA NA NA.2 NA NA NA.3 NA NA NA.4 NA NA 7 7 2 8 8 3 9 9 4 10 10 5 I didn't expect a1 to be affected. Is aa[!aa$a2==1, ] an incorrect way to remove rows? Any other way? (R 1.8.1. for Windows) Thanks in advance Juli __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] NA, deleting rows
On Thu, 18 Dec 2003 15:03:04 +0100 juli g. pausas wrote: Dear colleges, I do not understand the following behaviour: aa - data.frame(a1= 1:10, a2= c(rep(NA, 5), 1:5) ) aa a1 a2 1 1 NA 2 2 NA 3 3 NA 4 4 NA 5 5 NA 6 6 1 7 7 2 8 8 3 9 9 4 10 10 5 aa[!aa$a2==1, ] # removing rows with a2==1 a1 a2 NA NA NA NA.1 NA NA NA.2 NA NA NA.3 NA NA NA.4 NA NA 7 7 2 8 8 3 9 9 4 10 10 5 I didn't expect a1 to be affected. Is aa[!aa$a2==1, ] an incorrect way to remove rows? It leads to the behaviour above if there are NAs in the logical vector used for indexing: R !aa$a2==1 [1]NANANANANA FALSE TRUE TRUE TRUE TRUE Any other way? Several other ways are conceivable to treat the NA rows differently. This precise problem is solved, e.g., by R aa[-which(aa$a2==1), ] a1 a2 1 1 NA 2 2 NA 3 3 NA 4 4 NA 5 5 NA 7 7 2 8 8 3 9 9 4 10 10 5 hth, Z (R 1.8.1. for Windows) Thanks in advance Juli __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] How to create Voronoi-Polygons ?
Roger Koenker wrote: One should doubt everything, even logic, and in doubt lies possibility. If we doubt logic, discourse becomes impossible. cheers, Rolf Turner __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R]: Lp norm estimation
Allan - Brian Ripley's implementation of one of the more useful Lp norms is: library(lqs) help(lqs) This is very highly recommended for practical data analysis. - tom blackwell - u michigan medical school - ann arbor - On Thu, 18 Dec 2003, allan clark wrote: Hi all Just wondering whether one can undertake Lp norm estimation (a type of regression analysis) in R? i.e. argmin S ( | y(i) - x(i)b | ^p ) where: * S is the summation over observation i= 1,2,...,n * y is a vector of n observations * x is an n by p matrix of explanatory variables * b is a p by 1 vector of beta coefficients and * p is a constant to be estimated such that p= 1 Regards Allan __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R]: Lp norm estimation
Hi Allan, I think the function lmp() of the package normalp could be useful to you. Regards, Elio allan clark wrote: Hi all Just wondering whether one can undertake Lp norm estimation (a type of regression analysis) in R? i.e. argmin S ( | y(i) - x(i)b | ^p ) where: * S is the summation over observation i= 1,2,...,n * y is a vector of n observations * x is an n by p matrix of explanatory variables * b is a p by 1 vector of beta coefficients and * p is a constant to be estimated such that p= 1 Regards Allan [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] ESS tab completion for file names
Sean Davis wrote: I don't think that this works within the R process buffer, but I could be wrong. Does the documentation say that it should somewhere? Sean The ESS doc says (section 3.2): Completion is also provided over file names, which is particularly useful when using S functions such as get() or scan() (...) whenever the cursor is within an S string, pressing TAB completes the file name before point, and also expands any '~' or environment variable references. So this should work, but maybe something is wrong with my configuration? Pascal __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] prevent aov re-ordering of model terms
Is there a way to prevent the re-ordering of factors by aov? I do have a three-way interaction that I do want to fit before a two-way interaction (different factors, so they are not nested), but R moves the two-way interaction to the front. I know it generally makes sense to fit the two-way interactions first, but in this case I think I know what I'm doing. + hv + hv:rep + hv:soil + hv:spdiv + hv:spdivnom + hv:fgdiv + hv:fgdivnom + hv:soil:spdiv + hv:soil:spdivnom + hv:soil:fgdiv + hv:soil:fgdivnom + hv:mx#-- that one here + hv:soil:mx mx is a random factor, and I do want to semi-manually test the three-way interactions against hv:mx. soil is treated as fixed effect. I know I can fit the first part, then save the residuals, and then fit the last two terms, but it would be really nice not to have to do this in two steps. Pascal __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] symbolic and algebraic computation
There is also the open source program Pari: Quote: I would like to announce the release of pari-2.2.7.ALPHA. The sources can be obtained using the old address ftp://megrez.math.u-bordeaux.fr/pub/pari/pari-alpha.tgz or (preferably) through the new website: http://pari.math.u-bordeaux.fr/download.html where an updated Windows binary is available. See also Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm Delivered-To: mailing list [EMAIL PROTECTED] Received: (qmail 1259 invoked from network); 18 Dec 2003 00:44:41 - Received: from mathups.math.u-psud.fr (HELO matups.math.u-psud.fr) (129.175.52.4) by stoneport.math.uic.edu with SMTP; 18 Dec 2003 00:44:41 - Received: from geo.math.u-psud.fr (geo.math.u-psud.fr [129.175.50.56]) by matups.math.u-psud.fr (8.12.10/jtpda-5.4) with ESMTP id hBI0iG0s010962 for [EMAIL PROTECTED]; Thu, 18 Dec 2003 01:44:16 +0100 (MET) Received: by geo.math.u-psud.fr (Postfix, from userid 20603) id 204992985B; Thu, 18 Dec 2003 01:44:16 +0100 (MET) Date: Thu, 18 Dec 2003 01:44:16 +0100 From: Karim Belabas [EMAIL PROTECTED] To: pari-announce list [EMAIL PROTECTED] Christian -- Dr.sc.math.Christian W. Hoffmann, http://www.wsl.ch/staff/christian.hoffmann Mathematics + Statistical Computing e-mail: [EMAIL PROTECTED] Swiss Federal Research Institute WSL Tel: ++41-1-739 22.. ..77 (self) CH-8903 Birmensdorf, Switzerland ..11 (exchange) ..15 (Fax) Zuercherstrasse 111 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] beginner programming question
On Wed, 17 Dec 2003, Tony Plate wrote: Another way to approach this is to first massage the data into a more regular format. This may or may not be simpler or faster than other solutions suggested. You could also use the reshape() command to do the massaging -thomas x - read.table(clipboard, header=T) x rel1 rel2 rel3 age0 age1 age2 age3 sex0 sex1 sex2 sex3 113 NA 25 232 NA121 NA 2413 35 67 34 102212 3144 39 40 59 601221 44 NA NA 45 70 NA NA22 NA NA nn - c(rel,age0,age,sex0,sex) xx - rbind(colnames-(x[,c(rel1,age0,age1,sex0,sex1)], nn), + colnames-(x[,c(rel2,age0,age2,sex0,sex2)], nn), + colnames-(x[,c(rel3,age0,age3,sex0,sex3)], nn)) xx rel age0 age sex0 sex 11 25 231 2 24 35 672 2 31 39 401 2 44 45 702 2 11 3 25 21 1 21 1 35 342 1 31 4 39 591 2 41 NA 45 NA2 NA 12 NA 25 NA1 NA 22 3 35 102 2 32 4 39 601 1 42 NA 45 NA2 NA rbind(subset(xx, xx$rel==1 (xx$sex0==1 | xx$sex0==xx$sex))[,c(age0,age)], subset(xx, xx$rel==1 xx$sex==1 xx$sex0!=xx$sex)[,c(age,age0)]) age0 age 125 23 339 40 21 35 34 hope this helps, Tony Plate PS. To advanced R users: Is the above usage of the colnames- function within an expression regarded as acceptable or as undesirable programming style? -- I've rarely seen it used, but it can be quite useful. At Wednesday 09:28 PM 12/17/2003 +0200, Adrian Dusa wrote: Hi all, The last e-mails about beginners gave me the courage to post a question; from a beginner's perspective, there are a lot of questions that I'm tempted to ask. But I'm trying to find the answers either in the documentation, either in the about 15 free books I have, either in the help archives (I often found many similar questions posted in the past). Being an (still actual) user of SPSS, I'd like to be able to do everything in R. I've learned that the best way of doing it is to struggle and find a solution no matter what, refraining from doing it with SPSS. I've became more and more aware of the almost unlimited possibilities that R offers and I'd like to completely switch to R whenever I think I'm ready. I have a (rather theoretical) programming problem for which I have found a solution, but I feel it is a rather poor one. I wonder if there's some other (more clever) solution, using (maybe?) vectorization or subscripting. A toy example would be: rel1 rel2 rel3 age0 age1 age2 age3 sex0 sex1 sex2 sex3 1 3 NA25 23 2 NA 1 2 1 NA 4 1 3 35 67 34 10 2 2 1 2 1 4 4 39 40 59 60 1 2 2 1 4 NANA45 70 NANA 2 2 NANA where rel1...3 states the kinship with the respondent (person 0) code 1 meaning husband/wife, code 4 meaning parent and code 3 for children. I would like to get the age for husbands (code 1) in a first column and wife's age in the second: ageh agew 25 23 34 35 39 40 My solution uses *for* loops and *if*s checking for code 1 in each element in the first 3 columns, then checking in the last three columns for husband's code, then taking the corresponding age in a new matrix. I've learned that *for* loops are very slow (and indeed with my dataset of some 2000 rows and 13 columns for kinship it takes quite a lot). I found the Looping chapter in S poetry very useful (it did saved me from *for* loops a couple of times, thanks!). Any hints would be appreciated, Adrian Adrian Dusa ([EMAIL PROTECTED]) Romanian Social Data Archive (www.roda.ro http://www.roda.ro/ ) 1, Schitu Magureanu Bd. 76625 Bucharest sector 5 Romania Tel./Fax: +40 (21) 312.66.18\ +40 (21) 312.02.10/ int.101 [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help Thomas Lumley Assoc. Professor, Biostatistics [EMAIL PROTECTED] University of Washington, Seattle __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Summaries
If DF = a data.frame with 65000 rows and k columns, the following will do what I read in your question: lapply(DF, table) See, e.g., Venables and Ripley, Modern Applied Statistics with S (Springer, pp. 33-34 in the 4th edition, 2002). hope this helps. Perez Martin, Agustin wrote: Hello UseRs: Excuses for my english. I have a dataset with 65000 records and I'd like to make a summary where I can view all the values (with the number of times that it repeats) that there are each column of my dataset. I tried with summary( ), str( ), but nothing gives me the result that I am loking for. Thank you very much. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] mailing list for basic questions - preliminary sum up
On Thu, 18 Dec 2003, Mulholland, Tom wrote: 1 An assumption on my part is that there is fundamental agreement that the document is the best source for advice on how to ask questions of this list I don't think its the best possible source. It may well be the best existing source. On bug reporting, I think Simon Tatham's essay at http://www.chiark.greenend.org.uk/~sgtatham/bugs.html is a definite improvement over the GNU emacs-based text in the FAQ. It makes basically the same points, but explains *why*. -thomas __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] ESS tab completion for file names
Alternatively, C-c TAB might work. Pascal A. Niklaus [EMAIL PROTECTED] writes: Sean Davis wrote: I don't think that this works within the R process buffer, but I could be wrong. Does the documentation say that it should somewhere? Sean The ESS doc says (section 3.2): Completion is also provided over file names, which is particularly useful when using S functions such as get() or scan() (...) whenever the cursor is within an S string, pressing TAB completes the file name before point, and also expands any '~' or environment variable references. So this should work, but maybe something is wrong with my configuration? Pascal __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- [EMAIL PROTECTED]http://www.analytics.washington.edu/ Biomedical and Health Informatics University of Washington Biostatistics, SCHARP/HVTN Fred Hutchinson Cancer Research Center UW (Tu/Th/F): 206-616-7630 FAX=206-543-3461 | Voicemail is unreliable FHCRC (M/W): 206-667-7025 FAX=206-667-4812 | use Email CONFIDENTIALITY NOTICE: This e-mail message and any attachme...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] NA, deleting rows
On Thu, 18 Dec 2003, juli g. pausas wrote: Dear colleges, I do not understand the following behaviour: aa - data.frame(a1= 1:10, a2= c(rep(NA, 5), 1:5) ) aa[!aa$a2==1, ] # removing rows with a2==1 a1 a2 NA NA NA NA.1 NA NA NA.2 NA NA NA.3 NA NA NA.4 NA NA 7 7 2 8 8 3 9 9 4 10 10 5 I didn't expect a1 to be affected. You should think of NA as being pronounced Don't Know. That is you are asking for all rows where a2==1 to be removed and you don't know whether to remove the first five rows. The result is that you don't know what the result is in the first five rows. There is a good case for making this give an error or warning. -thomas __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] mailing list for basic questions - preliminary sum up
On Wed, 17 Dec 2003, Gabor Grothendieck wrote: In rereading this one idea occurred to me. What if the entire R help system were turned into a wiki? That is, ?whatever would take you to the help page, but not on your computer -- rather to the same page on the wiki. This seems to assume that you are attached to the internet (or at least that R can reliably tell if you are). -thomas __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] mailing list for basic questions - preliminary sum up
I had made a second subsequent suggestion to address this. See: https://www.stat.math.ethz.ch/pipermail/r-help/2003-December/042234.html --- Date: Thu, 18 Dec 2003 07:48:26 -0800 (PST) From: Thomas Lumley [EMAIL PROTECTED] To: Gabor Grothendieck [EMAIL PROTECTED] Cc: [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: Re: [R] mailing list for basic questions - preliminary sum up On Wed, 17 Dec 2003, Gabor Grothendieck wrote: In rereading this one idea occurred to me. What if the entire R help system were turned into a wiki? That is, ?whatever would take you to the help page, but not on your computer -- rather to the same page on the wiki. This seems to assume that you are attached to the internet (or at least that R can reliably tell if you are). -thomas __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Collapsing Arrays/Lists to scalar values
This is probably an easy question. I want to join the elements of a list/array into a single scalar value. How can I do this? More Background: I have sql queries stored in external flat text files. When I read these queries into R using the normal functions, I get a list where each line is an element in the list. When I try to pass this to the appropriate RODBC function, I get an errror. The function expects a scalar value for the query text. Someone must have run into this problem before. So thanks in advance for the help. Chris. Christopher Brown - [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] R GUI dies using postcript() in Windows XP Pro
Dear List, My colleague has been having a problem with the following data and plotting commands. The example below is part of a larger set of plots, but I've isolated the problem to this example using this small dataset (below), which kills rgui consistently. My version info version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major1 minor8.0 year 2003 month10 day 08 language R But this also happens in 1.8.1 on Windows XP Pro The code seems to stop at the call to plot() in the code below, and then MS's error reporting window pops up and informs us that rgui has been closed. Note that the same code, but without the postcript() and dev.off() commands works as expected to produce the plot on a windows device. Any ideas as to what is going on? All the best, Gav #code to run to reproduce the problem year - c(1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002) avgMsr - c(10.80, 7.00, 6.20, 9.571429, 10.80, 11.60, 10.20, 11.40, 7.20, 9.40, 11.20, 11.60, 11.60, 8.00, 7.60) totMsr - c(19, 17, 13, 24, 17, 17, 21, 18, 13, 15, 19, 18, 21, 15, 11) postscript(file=invert.eps, onefile=FALSE, horizontal = FALSE, pointsize = 8) op - par(mar = c(3,4,1.5,1)+0.1,font.main=16,tcl=-0.2) plot(x = year, y = avgMsr, ylab = Species richness, main = Loch Coire nan Arr, axes = FALSE, ylim = c(0,25), xlim = c(1988,2002)) axis(2, las=1) axis(1) lines(x = year, y = avgMsr) points(x = year, y = totMsr , col = black, pch = 19, type = o) lines(x = year, y = totMsr) box() par(op) dev.off() -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [T] +44 (0)20 7679 5522 ENSIS Research Fellow [F] +44 (0)20 7679 7565 ENSIS Ltd. ECRC [E] [EMAIL PROTECTED] UCL Department of Geography [W] http://www.ucl.ac.uk/~ucfagls/cv/ 26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/ London. WC1H 0AP. %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] R GUI dies using postcript() in Windows XP Pro
The font.main = 16 in par() is having problems cooperating with pointsize = 8 in postscript(). One of them has to go and then the code is happy. This is probably a feature. HTH, Andy -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gavin Simpson Sent: Thursday, December 18, 2003 11:02 AM To: R-Help Subject: [R] R GUI dies using postcript() in Windows XP Pro Dear List, My colleague has been having a problem with the following data and plotting commands. The example below is part of a larger set of plots, but I've isolated the problem to this example using this small dataset (below), which kills rgui consistently. My version info version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major1 minor8.0 year 2003 month10 day 08 language R But this also happens in 1.8.1 on Windows XP Pro The code seems to stop at the call to plot() in the code below, and then MS's error reporting window pops up and informs us that rgui has been closed. Note that the same code, but without the postcript() and dev.off() commands works as expected to produce the plot on a windows device. Any ideas as to what is going on? All the best, Gav #code to run to reproduce the problem year - c(1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002) avgMsr - c(10.80, 7.00, 6.20, 9.571429, 10.80, 11.60, 10.20, 11.40, 7.20, 9.40, 11.20, 11.60, 11.60, 8.00, 7.60) totMsr - c(19, 17, 13, 24, 17, 17, 21, 18, 13, 15, 19, 18, 21, 15, 11) postscript(file=invert.eps, onefile=FALSE, horizontal = FALSE, pointsize = 8) op - par(mar = c(3,4,1.5,1)+0.1,font.main=16,tcl=-0.2) plot(x = year, y = avgMsr, ylab = Species richness, main = Loch Coire nan Arr, axes = FALSE, ylim = c(0,25), xlim = c(1988,2002)) axis(2, las=1) axis(1) lines(x = year, y = avgMsr) points(x = year, y = totMsr , col = black, pch = 19, type = o) lines(x = year, y = totMsr) box() par(op) dev.off() -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [T] +44 (0)20 7679 5522 ENSIS Research Fellow [F] +44 (0)20 7679 7565 ENSIS Ltd. ECRC [E] [EMAIL PROTECTED] UCL Department of Geography [W] http://www.ucl.ac.uk/~ucfagls/cv/ 26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/ London. WC1H 0AP. %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] R GUI dies using postcript() in Windows XP Pro
On Thu, 18 Dec 2003 18:02:07 +, Gavin Simpson [EMAIL PROTECTED] wrote : Dear List, My colleague has been having a problem with the following data and plotting commands. The example below is part of a larger set of plots, but I've isolated the problem to this example using this small dataset (below), which kills rgui consistently. My version info version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major1 minor8.0 year 2003 month10 day 08 language R But this also happens in 1.8.1 on Windows XP Pro I just tried it in 1.8.1, Win XP Pro, with no error, then tried in a relatively recent build of r-patched and saw the crash. I'll see if I can track it down. Duncan Murdoch The code seems to stop at the call to plot() in the code below, and then MS's error reporting window pops up and informs us that rgui has been closed. Note that the same code, but without the postcript() and dev.off() commands works as expected to produce the plot on a windows device. Any ideas as to what is going on? All the best, Gav #code to run to reproduce the problem year - c(1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002) avgMsr - c(10.80, 7.00, 6.20, 9.571429, 10.80, 11.60, 10.20, 11.40, 7.20, 9.40, 11.20, 11.60, 11.60, 8.00, 7.60) totMsr - c(19, 17, 13, 24, 17, 17, 21, 18, 13, 15, 19, 18, 21, 15, 11) postscript(file=invert.eps, onefile=FALSE, horizontal = FALSE, pointsize = 8) op - par(mar = c(3,4,1.5,1)+0.1,font.main=16,tcl=-0.2) plot(x = year, y = avgMsr, ylab = Species richness, main = Loch Coire nan Arr, axes = FALSE, ylim = c(0,25), xlim = c(1988,2002)) axis(2, las=1) axis(1) lines(x = year, y = avgMsr) points(x = year, y = totMsr , col = black, pch = 19, type = o) lines(x = year, y = totMsr) box() par(op) dev.off() __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] R GUI dies using postcript() in Windows XP Pro
What do you think font.main=16 does? postscript() only has 5 fonts. Fortunately your example also crashes on Linux so was fairly easy to track down. The windows devices do have more fonts (19 by default). On Thu, 18 Dec 2003, Gavin Simpson wrote: Dear List, My colleague has been having a problem with the following data and plotting commands. The example below is part of a larger set of plots, but I've isolated the problem to this example using this small dataset (below), which kills rgui consistently. My version info version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major1 minor8.0 year 2003 month10 day 08 language R But this also happens in 1.8.1 on Windows XP Pro The code seems to stop at the call to plot() in the code below, and then MS's error reporting window pops up and informs us that rgui has been closed. Note that the same code, but without the postcript() and dev.off() commands works as expected to produce the plot on a windows device. Any ideas as to what is going on? All the best, Gav #code to run to reproduce the problem year - c(1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002) avgMsr - c(10.80, 7.00, 6.20, 9.571429, 10.80, 11.60, 10.20, 11.40, 7.20, 9.40, 11.20, 11.60, 11.60, 8.00, 7.60) totMsr - c(19, 17, 13, 24, 17, 17, 21, 18, 13, 15, 19, 18, 21, 15, 11) postscript(file=invert.eps, onefile=FALSE, horizontal = FALSE, pointsize = 8) op - par(mar = c(3,4,1.5,1)+0.1,font.main=16,tcl=-0.2) plot(x = year, y = avgMsr, ylab = Species richness, main = Loch Coire nan Arr, axes = FALSE, ylim = c(0,25), xlim = c(1988,2002)) axis(2, las=1) axis(1) lines(x = year, y = avgMsr) points(x = year, y = totMsr , col = black, pch = 19, type = o) lines(x = year, y = totMsr) box() par(op) dev.off() -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] R GUI dies using postcript() in Windows XP Pro
Dear Andy, Duncan and Brian Cheers for your replies That font.main thing is something I didn't pick up on when I cropped my colleagues code down to a small example. font.main works fine with pointsize = 8, *if* you set font.main to one of the values given in the entry for font in ?par. The code example I posted works if I set font.main to 3 (for italics) for example, which is what was produced with font.main = 16 on a windows() device. And Brian has confirmed that postcript devices have only 5 fonts in R. Not really a /feature/ though, I'd expect an error message telling me to not be so stupid next time... ;-) Once again, thank you all for your replies. Gav -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [T] +44 (0)20 7679 5522 ENSIS Research Fellow [F] +44 (0)20 7679 7565 ENSIS Ltd. ECRC [E] [EMAIL PROTECTED] UCL Department of Geography [W] http://www.ucl.ac.uk/~ucfagls/cv/ 26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/ London. WC1H 0AP. %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] R GUI dies using postcript() in Windows XP Pro
What is intended to happen is for it silently to use font 1. I am committing a fix to ensure that happens in the one spot that got missed. On Thu, 18 Dec 2003, Gavin Simpson wrote: Dear Andy, Duncan and Brian Cheers for your replies That font.main thing is something I didn't pick up on when I cropped my colleagues code down to a small example. font.main works fine with pointsize = 8, *if* you set font.main to one of the values given in the entry for font in ?par. The code example I posted works if I set font.main to 3 (for italics) for example, which is what was produced with font.main = 16 on a windows() device. And Brian has confirmed that postcript devices have only 5 fonts in R. Not really a /feature/ though, I'd expect an error message telling me to not be so stupid next time... ;-) Once again, thank you all for your replies. Gav -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] diagnostic information in glm. How about N of missing observations?
I handed out some results from glm() and the students ask how many observations were dropped due to missing values? How would I know? In other stat programs, the results will typically include N and the number dropped because of missings. Without going back to R and fiddling about to find the total number of rows in the dataframe, there is no way to tell. Somewhat inconvenient. Do you agree? -- Paul E. Johnson email: [EMAIL PROTECTED] Dept. of Political Sciencehttp://lark.cc.ku.edu/~pauljohn 1541 Lilac Lane, Rm 504 University of Kansas Office: (785) 864-9086 Lawrence, Kansas 66044-3177 FAX: (785) 864-5700 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] diagnostic information ....
Paul E. Johnson wrote: I handed out some results from glm() and the students ask how many observations were dropped due to missing values? How would I know? In other stat programs, the results will typically include N and the number dropped because of missings. Without going back to R and fiddling about to find the total number of rows in the dataframe, there is no way to tell. Somewhat inconvenient. Do you agree? In a word: No. R is ``not like other packages'' which spew out enormous printouts including every statistic known to man and a few known only to woman. R basically gives you what you ask for, and assumes you know enough to know what to ask for. It does not condescendingly make decisions for you and hand-cuff you into doing a standard analysis. It also allows infinitely versatile customization with consumate ease since it is a beautifully designed programming language. It would be ***VERY*** easy to write a wrapper for glm() to include the number of dropped observations if you want to include that information in a ``printout''. cheers, Rolf Turner [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] diagnostic information in glm. How about N of missing observations?
There should be an element of the fitted model object called `na.action' which (if you used the default na.omit()) should tell you which observations were dropped. -roger Paul Johnson wrote: I handed out some results from glm() and the students ask how many observations were dropped due to missing values? How would I know? In other stat programs, the results will typically include N and the number dropped because of missings. Without going back to R and fiddling about to find the total number of rows in the dataframe, there is no way to tell. Somewhat inconvenient. Do you agree? __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] help installing Design package OS-X
I'm wondering if someone has installed the Design library on OS-X. I have the Developer tools installed (not the OS X SDK kit) but after downloading the library via RAqua package manager I get the following errors: Installation of package Design had a non-zero exit status in : install.packages(ui.pks, CRAN= getOption(where), lib = .libPath()[1] or install.fom.file() npackage installatiion failed in case someone has the binary package for OS-X , please let me know. frank mattes -- Frank Mattes, MDe-mail: [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] symbolic and algebraic computation
Dear Angel, I needed a symbolic and algebraic computation software. The best solution I've found so far is maxima computer algebra system. Maybe there is also the CAS MuPAD of interest, which has the look and feel of maple, works under Linux, Mac and Windows - and has a free academic version, called MuPAD-Light. This free version is mathematical fully functional, comes with full documentation, but has only a rudimentary GUI, e.g. only allows to edit the last line - so you has sometimes to copy and past ... ;-) Give it a try. Here are the pointers: in general: http://www.mupad.de/ http://www.mupad.de/schule/en/ Download, approx. 20 MB: http://www.mupad.de/schule+studium/download/mupad_light_250_win.exe http://www.mupad.de/schule+studium/download/mupad_light_250_linux_bin.tgz 30-days-eval of profi version: http://www.mupad.de/schule+studium/download/mupad_pro_de_250_win.exe http://www.mupad.de/schule+studium/download/mupad_pro_252_macosx.img.gz best whishes Wolfgang -- Wolfgang Lindner [EMAIL PROTECTED] Universität Duisburg-Essen, Campus Duisburg Fakultaet 4 - Institut fuer Mathematik, Gebaeude: LE Zimmer: 424 Lotharstr. 65 Tel: +49 0203 379-1326 D-47048 Duisburg Fax: +49 0203 379-2528 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] mclust - clustering by spatial patterns
Dear All, I have spatial data (presence/absence for 4000 squares) on 250 bird species and would like to use a model-based clustering technique to test for species associations. Is there any way of passing a distance/correlation matrix to mclust as with hclust, rather than the actual data? Or alternatively, is there a way of getting mclust to handle binary data? I'd appreciate any suggestions! Cheers, Jarrod __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Help with predict.Arima with external regressor values
Hi all there I am enjoying R since 2 weeks and I come to my first deadlock, il am trying to use predict.Arima in the ts package. I get a Error in cbind(...) : cannot create a matrix from these types -- Start R session - fitdiv - arima(data, c(2, 0, 3), xreg = y ) ; print(fitdiv) Call: arima(x = data, order = c(2, 0, 3), xreg = y) Coefficients: ar1 ar2 ma1 ma2 ma3 intercept EUSA1 EUSA10 EUSA15 EUSA20EUSA5 H15T10Y H15T1Y H15T20Y H15T3M H15T5Y USSW10 -0.001 0.6502 0.3328 -0.5021 -0.1135-0.0535 0.0469 0.0075 -0.0263 0.0299 -0.0344 0.1012 -0.0382 0.0092 0.0385 -0.0757 -0.1577 s.e. 0.523 0.4002 0.5262 0.2711 0.0828 0.1027 0.0308 0.0802 0.0931 0.0743 0.0414 0.0469 0.0215 0.0360 0.0276 0.0344 0.0477 USSW15 USSW20 USSW30 USSW5 CAC.INDEX DAX.INDEX MIB30.INDEX OMX.INDEX SX5P.INDEX UKX.INDEX VDAX.INDEX VIX.INDEX 0.0254 -0.0141 0.0133 0.1186-0.1816 0.0652 0.0848-0.1836 0.1134-0.1742 0.0236-0.0482 s.e. 0.0588 0.0251 0.0363 0.0278 0.0907 0.0528 0.0860 0.0516 0.1518 0.1025 0.0591 0.0470 sigma^2 estimated as 1.258: log likelihood = -762.3, aic = 1584.59 fordiv - predict(fitdiv, n.ahead = 2, newxreg = newregy , se.fit = TRUE) Error in cbind(...) : cannot create a matrix from these types str(data) num [1:497] -0.34 -1.36 -0.5 -0.46 0.01 0.1 0.68 0.06 0.16 0.48 ... str(newregy) num [1, 1:23] -0.6 -0.3 0.15 1.08 -1.8 3 2 3 0 5 ... - attr(*, dimnames)=List of 2 ..$ : chr 498 ..$ : chr [1:23] EUSA1 EUSA10 EUSA15 EUSA20 ... str(y) `data.frame': 497 obs. of 23 variables: $ EUSA1 : num 0.7 5.9 -0.6 1.8 5.7 1.9 0.5 -6.6 2.5 2.3 ... $ EUSA10 : num -4.5 3.8 -11.7 3.2 4.2 -5.4 -2.2 -6.5 0.8 2 ... $ EUSA15 : num -5.4 3.6 -11 3.7 3.4 -4.3 -3.9 -4.7 0.3 2.6 ... $ EUSA20 : num -5 3.6 -10.8 4.3 2.3 -4.1 -3.5 -5 0 3.1 ... $ EUSA5 : num -4.3 5.4 -10.8 2.5 6.3 -2.4 -1.3 -6.6 2.3 -0.2 ... $ H15T10Y: num -4 2 -9 1 0 -10 -8 -1 -3 0 ... $ H15T1Y : num -4 1 -6 0 -2 -7 -12 2 -1 2 ... $ H15T20Y: num -3 4 -11 1 -1 -12 -4 2 -6 2 ... $ H15T3M : num -1 -1 -4 0 0 0 -10 0 2 1 ... $ H15T5Y : num -4 2 -11 0 -1 -11 -13 1 -1 2 ... $ USSW10 : num -8.6 0.6 -10.5 2.4 -2.9 -5.8 -15 0.4 -3.5 1 ... $ USSW15 : num -7.9 1.1 -9.8 2 -3.1 -5.8 -13.2 2 -4.4 2.1 ... $ USSW20 : num -6.7 1.4 -9.5 1.3 -3 -6 -11 1.2 -4.2 2.9 ... $ USSW30 : num -6.2 1.3 -8.4 1.6 -2.6 -6.9 -8.5 -0.9 -2.8 2.2 ... $ USSW5 : num -7.7 -0.4 -12.7 0.9 -4 -7.4 -17.5 0.9 0.3 1.6 ... $ CAC.INDEX : num 2.18 0.03 -1.45 -1.03 0.41 -1.57 0.86 -2.24 1.44 -2.08 ... $ DAX.INDEX : num 1.96 0.91 -1.64 0.08 0.99 -1.14 -0.35 -2.81 -0.08 -1.55 ... $ MIB30.INDEX: num 2.08 -0.48 -0.94 0.82 0.22 -2.22 0.8 -2.5 1.34 -1.35 ... $ OMX.INDEX : num 4.07 0.28 -0.56 -2.47 -0.16 -1.58 1.13 -3.5 -1.15 -1.85 ... $ SX5P.INDEX : num 1.95 0.1 -1.22 -1.01 -0.31 -0.96 0.84 -2.71 1.18 -1.05 ... $ UKX.INDEX : num 1.91 0.09 -0.57 -0.82 -0.42 -0.73 0.15 -1.65 1.02 -0.75 ... $ VDAX.INDEX : num -1.59 -0.74 0.73 -0.36 -0.36 0.87 -0.51 1.64 -0.02 0.85 ... $ VIX.INDEX : num -1.37 -0.89 1.22 0.16 0.3 -0.1 0.57 0.98 -0.88 0.75 ... fordiv - predict(fitdiv, n.ahead = 2, newxreg = matrix(0,1,23) , se.fit = TRUE) Error in cbind(...) : cannot create a matrix from these types -- End R session - I also tried to replace newregy by a matrix of zeros matrix(0,1,23) Please tell if I am doing something wrong ... I did not see any example in the help about external regressor so I had to start from scratch. Best regards Yves Oloui. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Help with predict.Arima with external regressor values [Repalced]
Hi all there I am enjoying R since 2 weeks and I come to my first deadlock, il am trying to use predict.Arima in the ts package. I get a Error in cbind(...) : cannot create a matrix from these types -- Start R session - fitdiv - arima(data, c(2, 0, 3), xreg = y ) ; print(fitdiv) Call: arima(x = data, order = c(2, 0, 3), xreg = y) Coefficients: ar1 ar2 ma1 ma2 ma3 intercept EUSA1 EUSA10 EUSA15 EUSA20EUSA5 H15T10Y H15T1Y H15T20Y H15T3M H15T5Y USSW10 -0.001 0.6502 0.3328 -0.5021 -0.1135-0.0535 0.0469 0.0075 -0.0263 0.0299 -0.0344 0.1012 -0.0382 0.0092 0.0385 -0.0757 -0.1577 s.e. 0.523 0.4002 0.5262 0.2711 0.0828 0.1027 0.0308 0.0802 0.0931 0.0743 0.0414 0.0469 0.0215 0.0360 0.0276 0.0344 0.0477 USSW15 USSW20 USSW30 USSW5 CAC.INDEX DAX.INDEX MIB30.INDEX OMX.INDEX SX5P.INDEX UKX.INDEX VDAX.INDEX VIX.INDEX 0.0254 -0.0141 0.0133 0.1186-0.1816 0.0652 0.0848-0.1836 0.1134-0.1742 0.0236-0.0482 s.e. 0.0588 0.0251 0.0363 0.0278 0.0907 0.0528 0.0860 0.0516 0.1518 0.1025 0.0591 0.0470 sigma^2 estimated as 1.258: log likelihood = -762.3, aic = 1584.59 fordiv - predict(fitdiv, n.ahead = 1, newxreg = newregy , se.fit = TRUE) Error in cbind(...) : cannot create a matrix from these types str(data) num [1:497] -0.34 -1.36 -0.5 -0.46 0.01 0.1 0.68 0.06 0.16 0.48 ... str(newregy) num [1, 1:23] -0.6 -0.3 0.15 1.08 -1.8 3 2 3 0 5 ... - attr(*, dimnames)=List of 2 ..$ : chr 498 ..$ : chr [1:23] EUSA1 EUSA10 EUSA15 EUSA20 ... str(y) `data.frame': 497 obs. of 23 variables: $ EUSA1 : num 0.7 5.9 -0.6 1.8 5.7 1.9 0.5 -6.6 2.5 2.3 ... $ EUSA10 : num -4.5 3.8 -11.7 3.2 4.2 -5.4 -2.2 -6.5 0.8 2 ... $ EUSA15 : num -5.4 3.6 -11 3.7 3.4 -4.3 -3.9 -4.7 0.3 2.6 ... $ EUSA20 : num -5 3.6 -10.8 4.3 2.3 -4.1 -3.5 -5 0 3.1 ... $ EUSA5 : num -4.3 5.4 -10.8 2.5 6.3 -2.4 -1.3 -6.6 2.3 -0.2 ... $ H15T10Y: num -4 2 -9 1 0 -10 -8 -1 -3 0 ... $ H15T1Y : num -4 1 -6 0 -2 -7 -12 2 -1 2 ... $ H15T20Y: num -3 4 -11 1 -1 -12 -4 2 -6 2 ... $ H15T3M : num -1 -1 -4 0 0 0 -10 0 2 1 ... $ H15T5Y : num -4 2 -11 0 -1 -11 -13 1 -1 2 ... $ USSW10 : num -8.6 0.6 -10.5 2.4 -2.9 -5.8 -15 0.4 -3.5 1 ... $ USSW15 : num -7.9 1.1 -9.8 2 -3.1 -5.8 -13.2 2 -4.4 2.1 ... $ USSW20 : num -6.7 1.4 -9.5 1.3 -3 -6 -11 1.2 -4.2 2.9 ... $ USSW30 : num -6.2 1.3 -8.4 1.6 -2.6 -6.9 -8.5 -0.9 -2.8 2.2 ... $ USSW5 : num -7.7 -0.4 -12.7 0.9 -4 -7.4 -17.5 0.9 0.3 1.6 ... $ CAC.INDEX : num 2.18 0.03 -1.45 -1.03 0.41 -1.57 0.86 -2.24 1.44 -2.08 ... $ DAX.INDEX : num 1.96 0.91 -1.64 0.08 0.99 -1.14 -0.35 -2.81 -0.08 -1.55 ... $ MIB30.INDEX: num 2.08 -0.48 -0.94 0.82 0.22 -2.22 0.8 -2.5 1.34 -1.35 ... $ OMX.INDEX : num 4.07 0.28 -0.56 -2.47 -0.16 -1.58 1.13 -3.5 -1.15 -1.85 ... $ SX5P.INDEX : num 1.95 0.1 -1.22 -1.01 -0.31 -0.96 0.84 -2.71 1.18 -1.05 ... $ UKX.INDEX : num 1.91 0.09 -0.57 -0.82 -0.42 -0.73 0.15 -1.65 1.02 -0.75 ... $ VDAX.INDEX : num -1.59 -0.74 0.73 -0.36 -0.36 0.87 -0.51 1.64 -0.02 0.85 ... $ VIX.INDEX : num -1.37 -0.89 1.22 0.16 0.3 -0.1 0.57 0.98 -0.88 0.75 ... fordiv - predict(fitdiv, n.ahead = 1, newxreg = matrix(0,1,23) , se.fit = TRUE) Error in cbind(...) : cannot create a matrix from these types -- End R session - I also tried to replace newregy by a matrix of zeros matrix(0,1,23) Please tell if I am doing something wrong ... I did not see any example in the help about external regressor so I had to start from scratch. Best regards Yves Oloui. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] diagnostic information ....
Rolf Turner wrote: Paul E. Johnson wrote: I handed out some results from glm() and the students ask how many observations were dropped due to missing values? How would I know? ... It would be ***VERY*** easy to write a wrapper for glm() to include the number of dropped observations if you want to include that information in a ``printout''. To wit naPrint - function(model,...) { if(!inherits(model,lm) || !inherits(model,glm)) stop(no support for class ,class(model),\n) if(!is.null(model$na.action)) { action - paste(na.action:,attr(model$na.action,class)) rows - as.numeric(model$na.action) list(action=action,rows=rows) } else { #no missing values list(action=options()$na.action, rows=NULL) } } Building this as a generic function and its methods is left as an exercise ;) So is a a prettier print method, and possibly a method for latex() or xtable(). Cheers Jason -- Indigo Industrial Controls Ltd. http://www.indigoindustrial.co.nz 64-21-343-545 [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] diagnostic information ....
Whoops. That should be a where I put a ||. naPrint - function(model,...) { if(!inherits(model,lm) !inherits(model,glm)) stop(no support for class ,class(model),\n) if(!is.null(model$na.action)) { action - paste(na.action:,attr(model$na.action,class)) rows - as.numeric(model$na.action) list(action=action,rows=rows) } else { #no missing values list(action=options()$na.action, rows=NULL) } } -- Indigo Industrial Controls Ltd. http://www.indigoindustrial.co.nz 64-21-343-545 [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] LotR:RotK + Linux 2.6.0 on the same day
Wednesday saw the release of both the movie Lord of the Rings: Return of the King (LotR:RotK) and the Linux 2.6.0 kernel. Those who enjoy geek humor should read the discussion on slashdot.org from people who are lost in the agonies of trying to decide whether to go see the movie or to compile the new kernel first. I have been running 2.6.0-test11 on a machine for several weeks and it is very good. The configuration/compiling process is much cleaner than in previous versions of the kernel and I really like the support for ATAPI optical drives. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] R and Sybase
Hi, I'm trying to get R connected to Sybase on a Linux machine. I'm relatively new to databases, particularly the connectivity side. Do I have to use RODBC and install ODBC support on the system (a huge pain with Sybase, as you have to install a scaled-down version of Sybase itself on the system to get it to work with ODBC), or can I somehow use DBI to do it. Other processes on the machine use DBI/DBD to talk to the database, but I have no idea how this would work with R. The file at http://cran.r-project.org/doc/manuals/R-data.pdf makes it seem like the DBI package is only a front-end, and I would need something like RSybase to actually use it. Any help would be greatly appreciated. Thank you, Peter __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] diagnostic information in glm. How about N of missing observations?
Check out ?summary.formula in package Hmisc. --- Date: Thu, 18 Dec 2003 13:27:39 -0600 From: Paul Johnson [EMAIL PROTECTED] To: '[EMAIL PROTECTED]' [EMAIL PROTECTED] Subject: [R] diagnostic information in glm. How about N of missing observations? I handed out some results from glm() and the students ask how many observations were dropped due to missing values? How would I know? In other stat programs, the results will typically include N and the number dropped because of missings. Without going back to R and fiddling about to find the total number of rows in the dataframe, there is no way to tell. Somewhat inconvenient. Do you agree? -- Paul E. Johnson email: [EMAIL PROTECTED] Dept. of Political Science http://lark.cc.ku.edu/~pauljohn 1541 Lilac Lane, Rm 504 University of Kansas Office: (785) 864-9086 Lawrence, Kansas 66044-3177 FAX: (785) 864-5700 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] R and Sybase
AFAIK the only way to connect to Sybase from R is with the RODBC package, so you need to have an ODBC driver for Sybase -- either one provided by Sybase or the FreeTDS ODBC driver from www.freetds.org. Regards, -- David Peter McMahan wrote: Hi, I'm trying to get R connected to Sybase on a Linux machine. I'm relatively new to databases, particularly the connectivity side. Do I have to use RODBC and install ODBC support on the system (a huge pain with Sybase, as you have to install a scaled-down version of Sybase itself on the system to get it to work with ODBC), or can I somehow use DBI to do it. Other processes on the machine use DBI/DBD to talk to the database, but I have no idea how this would work with R. The file at http://cran.r-project.org/doc/manuals/R-data.pdf makes it seem like the DBI package is only a front-end, and I would need something like RSybase to actually use it. Any help would be greatly appreciated. Thank you, Peter __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] help installing Design package OS-X
Frank - I recall some recent discussion on this list about installing Design on a Mac. Try the mail archive for a message from Frank Harrell, the package author and maintainer within the last five weeks. Your question sounds very similar to the question I remember . . . but mine is only a human memory. - tom blackwell - u michigan medical school - ann arbor - On Thu, 18 Dec 2003, Frank Mattes wrote: I'm wondering if someone has installed the Design library on OS-X. I have the Developer tools installed (not the OS X SDK kit) but after downloading the library via RAqua package manager I get the following errors: Installation of package Design had a non-zero exit status in : install.packages(ui.pks, CRAN= getOption(where), lib = .libPath()[1] or install.fom.file() npackage installatiion failed in case someone has the binary package for OS-X , please let me know. frank mattes -- Frank Mattes, MD e-mail: [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] mclust - clustering by spatial patterns
On Thu, 18 Dec 2003, Jarrod Hadfield wrote: Dear All, I have spatial data (presence/absence for 4000 squares) on 250 bird species and would like to use a model-based clustering technique to test for species associations. Is there any way of passing a distance/correlation matrix to mclust as with hclust, rather than the actual data? Or alternatively, is there a way of getting mclust to handle binary data? I'd appreciate any suggestions! Why not simply use dist() and hclust() ? Starting with presence/absence data, what could mclust() possibly do that is different from hclust() ? Cheers, Jarrod - tom blackwell - u michigan medical school - ann arbor - __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] mclust - clustering by spatial patterns
Thomas W Blackwell wrote: [...] Why not simply use dist() and hclust() ? Starting with presence/absence data, what could mclust() possibly do that is different from hclust() ? Um, fit a statistical model. - tom blackwell - u michigan medical school - ann arbor - __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- Dr Murray Jorgensen http://www.stats.waikato.ac.nz/Staff/maj.html Department of Statistics, University of Waikato, Hamilton, New Zealand Email: [EMAIL PROTECTED]Fax 7 838 4155 Phone +64 7 838 4773 wk+64 7 849 6486 homeMobile 021 1395 862 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] mclust - clustering by spatial patterns
On Fri, 19 Dec 2003, Murray Jorgensen wrote: Thomas W Blackwell wrote: [...] Why not simply use dist() and hclust() ? Starting with presence/absence data, what could mclust() possibly do that is different from hclust() ? Um, fit a statistical model. Yes, but ellipsoidal contours don't seem awfully useful in the discrete space of n = 4000 binary indicator variables. - tom blackwell - u michigan medical school - ann arbor - __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- Dr Murray Jorgensen http://www.stats.waikato.ac.nz/Staff/maj.html Department of Statistics, University of Waikato, Hamilton, New Zealand Email: [EMAIL PROTECTED]Fax 7 838 4155 Phone +64 7 838 4773 wk+64 7 849 6486 homeMobile 021 1395 862 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] for loop over dataframe without indices
One can perform a for loop without indices over the columns of a dataframe like this: for( v in df ) ... some statements involving v ... Is there some way to do this for rows other than using indices: for( i in 1:nrow(df) ) ... some statements involving df[i,] ... If the dataframe had only numeric entries I could transpose it and then do it over columns but what about the general case? __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] mclust - clustering by spatial patterns
You could just convert your binary spatial data to numeric 0/1 or -1/1 and give it to Mclust. That would violate the assumptions of the Gaussian model in Mclust, so you should be very careful about interpreting the results. However, if the results are at least as interesting as those you get from a non-model-based hierarchical clustering run, then that could be an indication that the approach has merit, and then you could investigate how to build a model-based clustering algorithm that is appropriate for your data. (I don't think it would be that hard to write down some equations giving the probability of each presence matrix being generated for each component of the mixture model, but I don't know how hard it would be implement the EM search for an appropriate mixture model.) -- Tony Plate At Thursday 08:55 PM 12/18/2003 +, Jarrod Hadfield wrote: Dear All, I have spatial data (presence/absence for 4000 squares) on 250 bird species and would like to use a model-based clustering technique to test for species associations. Is there any way of passing a distance/correlation matrix to mclust as with hclust, rather than the actual data? Or alternatively, is there a way of getting mclust to handle binary data? I'd appreciate any suggestions! Cheers, Jarrod __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] R and Sybase
On Thu, Dec 18, 2003 at 05:37:49PM -0500, David James wrote: AFAIK the only way to connect to Sybase from R is with the RODBC package, so you need to have an ODBC driver for Sybase -- either one provided by Sybase or the FreeTDS ODBC driver from www.freetds.org. Seconded -- we did that recently at work with RODBC unixODBC FreeTDS, all sitting on Solaris. Everything pretty much works out of the box, and it was a little tedious to build everything. I see no reason why that shouldn't work the same on Linux. Dirk -- Those are my principles, and if you don't like them... well, I have others. -- Groucho Marx __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] weighted regression
To all I have some simple questions pertaining to weights used in regression. If the variability of the dependent variable (y) is a function of the magnitude of predictor variable (x), can the use of weights give an appropriate answer to the regression parameters and the std errors? Assume that y at x=1 and 6 has a standard deviation of 0.1 and at x=11 it is 0.4 Then according to a web page on weighted regression for a calibration curve at http://member.nifty.ne.jp/mniwa/rev006.htm, I should use 1/(std^2) for each weight. i.e. for x=1 and 6, w = 100 and x=11, w = 6.25 In R the run is: y-c(1,6,11) x-c(6.7,6.7,6.6) w-c(100,100,6.25) reg -lm(x~y, weight=w) summary(reg) Call: lm(formula = x ~ y, weights = w) Residuals: 123 -0.04762 0.09524 -0.19048 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 6.707619 0.025431 263.762 0.00241 ** y -0.002857 0.005471 -0.522 0.69361 --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 Residual standard error: 0.2182 on 1 degrees of freedom Multiple R-Squared: 0.2143, Adjusted R-squared: -0.5714 F-statistic: 0.2727 on 1 and 1 DF, p-value: 0.6936 Am I using the weight method correctly? And if so does the Estimated Std. Error for the Intercept and slope make sense? On another note. How does one do a regression with the origin fixed at 0? Merry Christmas REX [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] Collapsing Arrays/Lists to scalar values
li - list(1, 2, 3) li [[1]] [1] 1 [[2]] [1] 2 [[3]] [1] 3 paste(unlist(li), collapse= ) [1] 1 2 3 length( paste(unlist(li), collapse= ) ) [1] 1 -- Adaikalavan Ramasamy -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Christopher Brown Sent: Friday, December 19, 2003 1:25 AM To: [EMAIL PROTECTED] Subject: [R] Collapsing Arrays/Lists to scalar values This is probably an easy question. I want to join the elements of a list/array into a single scalar value. How can I do this? More Background: I have sql queries stored in external flat text files. When I read these queries into R using the normal functions, I get a list where each line is an element in the list. When I try to pass this to the appropriate RODBC function, I get an errror. The function expects a scalar value for the query text. Someone must have run into this problem before. So thanks in advance for the help. Chris. Christopher Brown - [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] for loop over dataframe without indices
Based on an off list email conversation, I had I am concerned that my original email was not sufficiently clear. Recall that I wanted to use a for loop to iterate over the rows of a dataframe without using indices. Its easy to do this over the columns (for(v in df) ...) but not for rows. What I wanted to do is might be something like this. Define a function, rows, which takes a dataframe, df, as input and converts it to the structure: list(df[1,], df[2,], ..., df[n,]) where there are n rows: rows - function( df ) { ll - NULL for( i in 1:nrow(df) ) ll - append( ll, list(df[i,]) ) ll } This allows us to iterate over the rows of df without indices like this: data( iris ) df - iris[1:3,] # use 1st 3 rows of iris data set as df for( v in rows(df) ) print(v) Of course, this involves iterating over the rows of df twice -- once within rows() and once in the for loop. Perhaps this is the price one must pay for being able to eliminate index computations from a for loop or is it? Have I answered my own question or is there a better way to use a for loop over the rows of a dataframe without indices? --- Date: Thu, 18 Dec 2003 19:20:04 -0500 From: Gabor Grothendieck [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: for loop over dataframe without indices One can perform a for loop without indices over the columns of a dataframe like this: for( v in df ) ... some statements involving v ... Is there some way to do this for rows other than using indices: for( i in 1:nrow(df) ) ... some statements involving df[i,] ... If the dataframe had only numeric entries I could transpose it and then do it over columns but what about the general case? __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] How small machines do you run R on?
One of R's goals has always been to run on minimal hardware, and we say for example (src/gnuwin32/CHANGES for rw1070) This version of R needs more memory and is slower to start up, because it loads more packages by default. This is only likely to be a concern on machines with 16Mb of memory or less than 300MHz processors. For such machines append R_DEFAULT_PACKAGES=ctest to the command line in the shortcut used to run R, when the memory usage will be about equal to that of rw1062. Are people actually using R on machines with less than 32Mb of memory or where it takes more than 10 seconds to start up, _and_ using a smaller set of default packages to alleviate this? If so, please let me (not the list) know. If we can safely assume 32Mb and a 500MHz processor (where the startup time for 1.8.1 is around 5 secs, less in R-devel) then we can make some changes now, including allowing the use of S4 classes in R's basic statistical functionality. (There are plans for 2004 that will load R objects on first use and so both speed up startup and reduce typical memory usage, but not until the second half of the year at the earliest.) (Until recently I was using a 170MHz 64Mb Sun from 1997 but R no longer builds on that machine.) -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Factor names levels
names() is only defined for vectors and lists and factors are neither. See ?vector and ?names for more info. --- From: djw1005 at cam.ac.uk Subject: [R] Factor names levels When I alter the levels of a factor, why does it alter the names too? f - factor(c(A=one,B=two,C=one,D=one,E=three), levels=c(one,two,three)) names(f) -- gives [1] A B C D E levels(f) - c(un,deux,trois) names(f) -- gives NULL I'm using R 1.8.0 for Windows. Damon. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] iterative proportional fitting
Dear all, I wonder if there are some function or package in R which can do the iterative proportional fitting. In the exponential model f(y1,...yn)=exp(a'yi+b'(yi*yj)+.+c'(y1*...*yn)+constance), instead of the canonical parameters, I use maginal probability instead of a and log odds ratio instead of b. and for the order higher than 3, I use the canonical way or even assume them to be 0. It is good if there is direct function or package in R to do the job, which will save a lot of time of me. Thank you! Rgs, Zhen __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help